Module UnionFind.Make
Parameters
X : Element
XSet : IStdlib.IStd.Caml.Set.S with type XSet.elt = X.t
XMap : IStdlib.IStd.Caml.Map.S with type XMap.key = X.t
Signature
type repr
= private X.t
val empty : t
val union : t -> X.t -> X.t -> t * (X.t * repr) option
return the optional new equality added between the old representatives of the two items in the form of "old representative = new representative",
None
if they were already in the same congruence class
val fold_congruences : (t, repr * XSet.t, 'acc) IStdlib.IStd.Container.fold
fold over the equivalence classes of the relation, singling out the representative for each class
val reorient : should_keep:(X.t -> bool) -> t -> X.t XMap.t
the relation
x -> x'
derived from the equality relation that relates allx
,x'
such that¬(should_keep x)
,should_keep x'
, andx=x'
, as well asy -> y'
when no element in the equivalence class ofy
satisfiesshould_keep
andy'
is the representative of the class