All Projects → deehzee → unionfind

deehzee / unionfind

Licence: MIT license
A union-find disjoint sets data structure implemented in Python with the "Weighted Quick Union with Path Compression" algorithm.

Programming Languages

python
139335 projects - #7 most used programming language
Jupyter Notebook
11667 projects

Projects that are alternatives of or similar to unionfind

icpc
Resources for Competitive Programming
Stars: ✭ 14 (-72.55%)
Mutual labels:  algorithms-datastructures
AlgoDaily
just for fun
Stars: ✭ 118 (+131.37%)
Mutual labels:  algorithms-datastructures
Data Structures And Algorithms
Data Structures and Algorithms implementation in Go
Stars: ✭ 2,272 (+4354.9%)
Mutual labels:  algorithms-datastructures
Data-Structures-and-Algorithms--A-Comprehensive-Guide
Data Structures & Algorithms - A Comprehensive Guide
Stars: ✭ 15 (-70.59%)
Mutual labels:  algorithms-datastructures
Awesome Python Scripts
🚀 Curated collection of Awesome Python Scripts which will make you go wow. Dive into this world of 360+ scripts. Feel free to contribute. Show your support by ✨this repository.
Stars: ✭ 198 (+288.24%)
Mutual labels:  algorithms-datastructures
DataStructures Algorithms Java
Collection of data structures and algorithms challenges that I've solved. 💤
Stars: ✭ 12 (-76.47%)
Mutual labels:  algorithms-datastructures
py-algorithms
Algorithms and Data Structures, solutions to common CS problems.
Stars: ✭ 26 (-49.02%)
Mutual labels:  union-find
Quick-notes
This repo contains important notes and code snippets which can help you during your job interviews
Stars: ✭ 37 (-27.45%)
Mutual labels:  algorithms-datastructures
ML-ProjectKart
🙌Kart of 210+ projects based on machine learning, deep learning, computer vision, natural language processing and all. Show your support by ✨ this repository.
Stars: ✭ 162 (+217.65%)
Mutual labels:  algorithms-datastructures
Java
All Algorithms implemented in Java
Stars: ✭ 42,893 (+84003.92%)
Mutual labels:  algorithms-datastructures
Learning-Made-Easy
This project can help you understand the Data Structure and Algorithms in a more efficient manner. It aims at scheduling the studies for maximizing marks during exams. Most students face this problem during exams that what to study to get the best out of their limited time.
Stars: ✭ 133 (+160.78%)
Mutual labels:  algorithms-datastructures
ds
🔗 Common Data Structures and Algorithms
Stars: ✭ 40 (-21.57%)
Mutual labels:  algorithms-datastructures
R-Data-Structures-and-Algorithms
R Data Structures and Algorithms, published by Packt
Stars: ✭ 27 (-47.06%)
Mutual labels:  algorithms-datastructures
programminginpython.com
This repo consists code of all the programs discussed at programminginpython.com website
Stars: ✭ 60 (+17.65%)
Mutual labels:  algorithms-datastructures
Leetcode
LeetCode Solutions: A Record of My Problem Solving Journey.( leetcode题解,记录自己的leetcode解题之路。)
Stars: ✭ 45,650 (+89409.8%)
Mutual labels:  algorithms-datastructures
Data Structures
A collection of powerful data structures
Stars: ✭ 2,534 (+4868.63%)
Mutual labels:  union-find
ProbQA
Probabilistic question-asking system: the program asks, the users answer. The minimal goal of the program is to identify what the user needs (a target), even if the user is not aware of the existence of such a thing/product/service.
Stars: ✭ 43 (-15.69%)
Mutual labels:  algorithms-datastructures
OI-Template
Bill Yang's algorithm & data structure templates
Stars: ✭ 15 (-70.59%)
Mutual labels:  algorithms-datastructures
Datastruct and algorithms
python/c++实现常用算法(数据结构,搜索,排序,动态规划...)
Stars: ✭ 31 (-39.22%)
Mutual labels:  algorithms-datastructures
Hello World
Add any Program in any language you like or add a hello world Program ❣️ if you like give us ⭐
Stars: ✭ 1,464 (+2770.59%)
Mutual labels:  algorithms-datastructures

UnionFind Implementation in Python

Union-find is a data structure that maintains disjoint set (called connected components or components in short) membership, and makes it easier to merge (union) two components, and to find if two elements are connected (i.e., belong to the same component).

This implements the "weighted-quick-union-with-path-compression" union-find algorithm. Only works if elements are immutable objects.

Worst case for union and find (N + M \log^* N), with N elements and M union/find operations. The function \log^* is the number of times needed to take \log (base 2) of a number until reaching 1. In practice, the amortized cost of each operation is nearly linear [1].

Update: This has now been packaged into an instalable pip package by Hagai Helman Tov (@hagai-helman). See the fork at https://github.com/hagai-helman/unionfind).

Contents

  • Module unionfind with the class UnionFind
  • An example notebook UnionFindExamples.ipynb
  • License: MIT.

Requirements

  • numpy
[1]http://algs4.cs.princeton.edu/lectures/
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].