4.3. Union Find
The unionfind module includes a basic implementation to do union-find, useful for many merge tree and connected component tasks throughout the code. _TODO_: Add more information about the module and write documentation for the pieces.
-
class cereeberus.compute.unionfind.UnionFind(vertices)[source]
Union find data structure
-
__init__(vertices)[source]
-
find(node)[source]
-
union(node1, node2)[source]
-
components_dict()[source]
Returns a dictionary mapping component representatives to lists of elements in that component.
- Returns:
A dictionary where keys are component representatives and values are lists of elements in that component.
- Return type:
dict