Module Unionfind

An imperative implementation of partitions via Union-Find

Paths are compressed imperatively at each lookup of a canonical representative. Each union also modifies in-place the partition structure.

Nota: for the moment we use Pervasive's comparison for choosing the smallest object as representative. This could be made more generic.

module type PartitionSig = sig ... end
module type SetS = sig ... end

Minimal interface for sets, subtype of stdlib's Set.

module type MapS = sig ... end

Minimal interface for maps, subtype of stdlib's Map.

module Make (S : SetS) (_ : MapS with type key = S.elt) : PartitionSig with type elt = S.elt and type set = S.t