|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ProGAL.geom3d.complex.alphaComplex.DisjointSet
public class DisjointSet
A class for maintaining disjoint sets using union-by-rank and path-compression. This gives an amortized runningtime of each union and find-operation of O(\alpha(n)). Except that a set is represented as an internal class that is associated with objects using a hash-map, this implementation follows the description in Cormen et. al 2001 and on http://en.wikipedia.org/wiki/Disjoint-set_data_structure (Jan. 2011).
Nested Class Summary | |
---|---|
class |
DisjointSet.Set
A class representing a set. |
Constructor Summary | |
---|---|
DisjointSet()
|
Method Summary | |
---|---|
DisjointSet.Set |
find(DisjointSet.Set s)
Determine which set a particular element is in. |
DisjointSet.Set |
find(java.lang.Object o)
Determine which set a particular element is in. |
DisjointSet.Set |
makeSet(java.lang.Object o)
Create a new set containing the element o |
void |
union(DisjointSet.Set x,
DisjointSet.Set y)
Merge two sets into a single set |
void |
union(java.lang.Object x,
java.lang.Object y)
Merge two sets into a single set. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DisjointSet()
Method Detail |
---|
public void union(java.lang.Object x, java.lang.Object y)
public void union(DisjointSet.Set x, DisjointSet.Set y)
public DisjointSet.Set find(DisjointSet.Set s)
find
can be compared by equality (i.e. "==" ).
public DisjointSet.Set find(java.lang.Object o)
find
can be compared by equality (i.e. "==" ).
Warning: To associate objects with sets the set has to be looked up in a list which takes O(n) time.
public DisjointSet.Set makeSet(java.lang.Object o)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |