In union-find-set.diesel:
Union_find_set
is a framework for fast union-find data structures,
where two union_find_set instances can be merged into a single
equivalence class (union_set
) and the canonical equivalence class
representative can be determined from any member (find_set
), in
near-linear time. The parameter refers to the specific subclass of
union_find_set being manipulated, so that e.g. find_set
on a
specific subclass returns the same kind of specific subclass rather
than a generic union_find_set
.
unify two sets
when two union_find_sets are merged, the helper function
merge_set
is
called with the chosen representative as the first argument and the other
representative as the other argument. subclasses of union_find_set are
expected to override this default method if they want to take action when
two equivalence classes are merged.
In dominant-union-find-set.diesel:
Dominant_union_find_set
is a subclass of union_find_set
where its
instances are known to always become the representative member of the
equivalence class.