Module Union_find


module Union_find: sig .. end
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.

type 'a t 
type 'a t is the type of objects, where each object is part of an equivalence class that is associated with a single value of type 'a.
val create : 'a -> 'a t
create v returns a new object in its own equivalence class that has value v.
val get : 'a t -> 'a
val set : 'a t -> 'a -> unit
val same_class : 'a t -> 'a t -> bool
val union : 'a t -> 'a t -> unit