Functional.GenericRelationalValuedSourceFunctional union find
('a, 'b) Relation.t on edges between elements and representativesThis is functional and immutable
module Elt : Parameters.GENERIC_ELTmodule Relation : Parameters.GENERIC_GROUPmodule Value : Parameters.GENERIC_VALUE with type ('a, 'b) relation = ('a, 'b) Relation.tSet of 'a Elt.t
Type of the union-find structure
Prints equivalence classes
Prints whole data structure
type 'a elt_through_relation = | EltThroughRel : 'b Elt.t * ('a, 'b) Relation.t -> 'a elt_through_relationtype 'a value_through_relation = | ValueThroughRelation : 'b Value.t option
* ('a, 'b) Relation.t -> 'a value_through_relationtype 'a all_through_relation = | AllThroughRelation : 'b Elt.t
* 'b Value.t option
* EltSet.t
* ('a, 'b) Relation.t -> 'a all_through_relationReturns the representative of the given element, along with the relation between the given element and its representative. O(1) complexity
Returns the class of the given element, O(1) complexity
Returns the value of the given element's representative (None for top), along with the relation between the given element and its representative. O(1) complexity
Returns the given element's representative, associated value (None for top), along with the relation between the given element and its representative. O(1) complexity
check_related uf a b returns the relation between a and b if they are in the same class.
add_value uf a v is uf with the value v added to a (Or more precisely, the value is added to the representative of a, via the relation between a and its representative). Intersects with previous value via Value.meet if one is present
val union :
t ->
'a Elt.t ->
'b Elt.t ->
('a, 'b) Relation.t ->
(t, ('a, 'b) Relation.t) resultunion uf a b r adds the r a b relation in uf. Returns Ok uf' with the new value if successful, and Error rel if a and b are already related by rel and r != rel.
join a b joins the two union find-structures:
Value.join of the old values