This preview shows pages 1–2. Sign up to view the full content.
The Disjoint Set Abstract Data Type
Equivalence Relations:
Reflexive (a R a), Symmetric (aRb
bRa), Transitive (aRb &
bRc => aRc)
Elements equivalent to each other form equivalent classes within a
set.
Equivalent elements form partition over a set: No element belongs
to two equivalence classes, and every element belongs to some
class
Dynamic Equivalence Problem / UnionFind Algorithm
Given a set, equivalence between the elements are gradually
declared:
{a, b, c, d, e, f, g}
Steps:
a Eq b:
{{a, b}, c, d, e, f, g}
e Eq c:
{{a, b}, {c, e}, d, f, g}
b Eq e:
{{a, b, c, e}, d, f, g}
f Eq g:
{{a, b, c, e}, d, {f, g}}
We have now 3 Equivalence classes in the set.
Needs the set
Union
operation.
Find
where does e belong. Answer: First set, or set of ‘a,’ or …
Typically needed for answering: does ‘a’ and ‘e’ are equivalent to
each other?
Doing
Union
also needs the
Find
algorithm:
b Eq e:
where does b and e belongs, then Union those two sets, if
they are currently not equivalent.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '12
 Dmitra
 Algorithms

Click to edit the document details