Imperative.GenericRelationalValued
Imperative union find
('a, 'b) Relation.t
on edges between terms and representativesPerforms union by size, and path compression in find.
This is fully imperative and mutable.
'a Term.t
union
between related nodesmodule Node : Parameters.UF_NODE
type 'a node_through_relation =
| NodeThoughRelation : 'b Node.Node.t
* ('a, 'b) Node.Relation.t -> 'a node_through_relation
type 'a value_through_relation =
| ValueThroughRelation : 'b Node.Value.t
* ('a, 'b) Node.Relation.t -> 'a value_through_relation
type 'a node_and_value_through_relation =
| NodeValueThroughRelation : 'b Node.Node.t
* 'b Node.Value.t
* ('a, 'b) Node.Relation.t -> 'a node_and_value_through_relation
val find_representative : 'a Node.Node.t -> 'a node_through_relation
Find the representative of a node, and the associated relation
val find_value : 'a Node.Node.t -> 'a value_through_relation
Find the value of a node, and the associated relation
val find : 'a Node.Node.t -> 'a node_and_value_through_relation
Find the value and representative of a node, and the associated relation
check_related a b
returns the relation between a
and b
if they are in the same class.
val add_value : 'a Node.Node.t -> 'a Node.Value.t -> unit
add_value a v
adds 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 :
'a Node.Node.t ->
'b Node.Node.t ->
('a, 'b) Node.Relation.t ->
unit
union m n r
adds the r(m,n) relation to the union find, refining the value of the chosen parent class using that of the chosen child via Value.value_intersection
.