Implements the Union Find Datastructure to maintain disjoint sets efficiently. More...
#include <ogdf/geometric/cr_min/datastructure/UnionFind.h>
Public Member Functions | |
| UnionFind (unsigned int max_element) | |
Create a new set representation with not more than max_element elements. | |
| void | all_to_singletons () |
| Assigns every element to a singleton set. | |
| unsigned int | find (unsigned int u) |
Find the representative to element u. | |
| void | merge (unsigned int u, unsigned int v) |
Merge the two sets containing u and v. | |
| unsigned int | operator[] (unsigned int u) |
Private Attributes | |
| std::vector< int > | data |
Implements the Union Find Datastructure to maintain disjoint sets efficiently.
Definition at line 45 of file UnionFind.h.
Create a new set representation with not more than max_element elements.
Initialy every element is in its own set.
| max_element | maximum number of elements |
Definition at line 55 of file UnionFind.h.
|
inline |
Assigns every element to a singleton set.
Set id is equal to element id.
Definition at line 63 of file UnionFind.h.
Find the representative to element u.
| u | element |
u Definition at line 70 of file UnionFind.h.
Merge the two sets containing u and v.
| u | element u |
| v | element v |
Definition at line 87 of file UnionFind.h.
Definition at line 80 of file UnionFind.h.
|
private |
Definition at line 47 of file UnionFind.h.