Module Core_kernel.Union_find
Imperative data structure for representing disjoint sets.
Union find is used to implement an equivalence relation on objects, where the equivalence relation can dynamically be coarsened by "union"ing two equivalence classes together.
All of the operations are effectively (amortized) constant time.
See Wikipedia.
This implementation is not thread-safe.
type 'a ttype 'a tis the type of objects, where each object is part of an equivalence class that is associated with a single value of type'a.
include Core_kernel__.Import.Invariant.S1 with type 'a t := 'a t
val invariant : 'a Base__.Invariant_intf.inv -> 'a t Base__.Invariant_intf.inv
val create : 'a -> 'a tcreate vreturns a new object in its own equivalence class that has valuev.
val get : 'a t -> 'aget treturns the value of the class oft.
val set : 'a t -> 'a -> Core_kernel__.Import.unitset t vsets the value of the class ofttov.
val same_class : 'a t -> 'a t -> Core_kernel__.Import.boolsame_class t1 t2returns true ifft1andt2are in the same equivalence class.
val union : 'a t -> 'a t -> Core_kernel__.Import.unitunion t1 t2makes the class oft1and the class oft2be the same (if they are already equal, then nothing changes). The value of the combined class is the value oft1ort2; it is unspecified which. Afterunion t1 t2, it will always be the case thatsame_class t1 t2.
module Private : sig ... end