A Union/Find data structure for maintaining disjoint sets. More...
#include <ogdf/basic/DisjointSets.h>
Public Member Functions | |
| DisjointSets (int maxNumberOfElements=(1<< 15)) | |
| Creates an empty DisjointSets structure. More... | |
| DisjointSets (const DisjointSets &)=delete | |
| ~DisjointSets () | |
| int | find (int set) |
Returns the id of the largest superset of set and compresses the path according to CompressionOptions. More... | |
| int | getNumberOfElements () |
| Returns the current number of elements. More... | |
| int | getNumberOfSets () |
| Returns the current number of disjoint sets. More... | |
| int | getRepresentative (int set) const |
Returns the id of the largest superset of set. More... | |
| int | link (int set1, int set2) |
Unions set1 and set2. More... | |
| int | makeSet () |
| Initializes a singleton set. More... | |
| DisjointSets & | operator= (const DisjointSets &)=delete |
| bool | quickUnion (int set1, int set2) |
Unions the maximal disjoint sets containing set1 and set2. More... | |
Private Attributes | |
| int | m_maxNumberOfElements |
| Maximum number of elements (array size) adjusted dynamically. More... | |
| int | m_numberOfElements |
| Current number of elements. More... | |
| int | m_numberOfSets |
| Current number of disjoint sets. More... | |
| int * | m_parameters |
| Maps set id to rank/size. More... | |
| int * | m_parents |
| Maps set id to parent set id. More... | |
| int * | m_siblings |
| Maps set id to sibling set id. More... | |
A Union/Find data structure for maintaining disjoint sets.
Definition at line 81 of file DisjointSets.h.
|
inlineexplicit |
Creates an empty DisjointSets structure.
| maxNumberOfElements | Expected number of Elements. |
Definition at line 124 of file DisjointSets.h.
|
delete |
|
inline |
Definition at line 138 of file DisjointSets.h.
|
private |
Definition at line 273 of file DisjointSets.h.
|
private |
Definition at line 302 of file DisjointSets.h.
|
private |
Definition at line 289 of file DisjointSets.h.
|
private |
Definition at line 317 of file DisjointSets.h.
|
private |
Definition at line 340 of file DisjointSets.h.
|
private |
Definition at line 333 of file DisjointSets.h.
|
inline |
Returns the id of the largest superset of set and compresses the path according to CompressionOptions.
| set | Set. |
set is a non negative properly initialized id. Definition at line 151 of file DisjointSets.h.
|
inline |
Returns the current number of elements.
Definition at line 242 of file DisjointSets.h.
|
inline |
Returns the current number of disjoint sets.
Definition at line 239 of file DisjointSets.h.
|
inline |
Returns the id of the largest superset of set.
| set | Set. |
set is a non negative properly initialized id. Definition at line 164 of file DisjointSets.h.
|
private |
Definition at line 603 of file DisjointSets.h.
|
private |
Definition at line 544 of file DisjointSets.h.
|
private |
Definition at line 583 of file DisjointSets.h.
|
private |
Definition at line 559 of file DisjointSets.h.
|
inline |
Unions set1 and set2.
set1 and set2 are maximal disjoint sets. Definition at line 217 of file DisjointSets.h.
|
inlineprivate |
Unions set1 and set2 w/o decreasing the numberOfSets.
set1 and set2 are maximal disjoint sets. Definition at line 250 of file DisjointSets.h.
|
inline |
Initializes a singleton set.
Definition at line 176 of file DisjointSets.h.
|
delete |
|
private |
Definition at line 407 of file DisjointSets.h.
|
private |
Use path splitting to compress the path of set1 and get the root
Redirect all nodes with smaller indices on the path of set2 to the root
Definition at line 444 of file DisjointSets.h.
|
private |
Definition at line 501 of file DisjointSets.h.
|
private |
Definition at line 349 of file DisjointSets.h.
|
private |
Definition at line 368 of file DisjointSets.h.
|
inline |
Unions the maximal disjoint sets containing set1 and set2.
set1 and set2 were disjoint und joined correctly. False otherwise. Definition at line 230 of file DisjointSets.h.
|
private |
Maximum number of elements (array size) adjusted dynamically.
Definition at line 90 of file DisjointSets.h.
|
private |
Current number of elements.
Definition at line 89 of file DisjointSets.h.
|
private |
Current number of disjoint sets.
Definition at line 83 of file DisjointSets.h.
|
private |
Maps set id to rank/size.
Definition at line 95 of file DisjointSets.h.
|
private |
Maps set id to parent set id.
Definition at line 94 of file DisjointSets.h.
|
private |
Maps set id to sibling set id.
Definition at line 96 of file DisjointSets.h.