Vocabulary
disjoint-sets

Inputs
assocan assoc


Outputs
disjoint-seta disjoint-set


Word description
Given an assoc representation of a graph where the keys are vertices and key/value pairs are edges, creates a disjoint set whose elements are the keys of assoc, and two keys are equivalent if they belong to the same connected component of the graph.

Examples
USING: disjoint-sets kernel prettyprint ; H{ { 1 1 } { 2 1 } { 3 4 } { 4 4 } { 5 3 } } assoc>disjoint-set 1 2 pick equiv? . 4 5 pick equiv? . 1 5 pick equiv? . drop
t t f


Definition