Constructor
new UnionFind() → {UnionFind}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
... |
Any | this structure will be initialized with the discrete partition on the given set of elements. |
Returns:
- UnionFind struct
- Type
- UnionFind
Methods
(static) get(object) → {String}
- Source:
Find and return the name of the set containing the object.
Parameters:
Name | Type | Description |
---|---|---|
object |
Any |
Returns:
- Type
- String
(static) groups() → {Iterator}
- Source:
Iterates over the sets stored in this structure.
Example
partition = UnionFind( 1, 2, 3 )
partition.groups() --> [ 1 ], [ 2 ], [ 3 ]
partition.union( 1, 2 )
partition.groups() --> [ 1, 2 ], [ 3 ]
Returns:
- Type
- Iterator
(static) union()
- Source:
Find the sets containing the objects and merge them all.
Parameters:
Name | Type | Description |
---|---|---|
... |
Any | objects |