module Union_find:Disjoint-sets.sig..end
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 tcreate v returns a new object in its own equivalence class that has value
v.val get : 'a t -> 'aget t returns the value of the class of t.val set : 'a t -> 'a -> unitset t v sets the value of the class of t to v.val same_class : 'a t -> 'a t -> boolsame_class t1 t2 returns true iff t1 and t2 are in the same equivalence
class.val union : 'a t -> 'a t -> unitunion t1 t2 makes the class of t1 and the class of t2 be the same
(if they are already equal, then nothing changes). The value of the
combined class is the value of t1 or t2; it is unspecified which.
After union t1 t2, it will always be the case that equals t1 t2.