Transform
matchlab.core.dsu
¶
Functions to transform data between tabular and graph structures.
Classes:
-
DisjointSet–Disjoint set forest with "path compression" and "union by rank" heuristics.
DisjointSet
¶
Bases: Generic[T]
flowchart TD
matchlab.core.dsu.DisjointSet[DisjointSet]
click matchlab.core.dsu.DisjointSet href "" "matchlab.core.dsu.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
Initialise the disjoint set.
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: