Transform
matchbox.common.transform
¶
Functions to transform data between tabular and graph structures.
Classes:
-
DisjointSet–Disjoint set forest with “path compression” and “union by rank” heuristics.
Functions:
-
hash_cluster_leaves–Canonical method to convert list of cluster IDs to their combined hash.
DisjointSet
¶
Bases: Generic[T]
flowchart TD
matchbox.common.transform.DisjointSet[DisjointSet]
click matchbox.common.transform.DisjointSet href "" "matchbox.common.transform.DisjointSet"
Disjoint set forest with “path compression” and “union by rank” heuristics.
This follows implementation from Cormen, Thomas H., et al. Introduction to algorithms. MIT press, 2022
Methods:
-
add–Add a new element to the disjoint set.
-
union–Merge the sets containing elements x and y.
-
get_components–Return the connected components of the disjoint set.
Attributes: