Everything2
Near Matches
Ignore Exact
Full Text
Everything2

union find

created by ariels

(thing) by ariels (1.5 d) (print)   ?   (I like it!) Sat Dec 16 2000 at 9:20:20

(Algorithms):
An abstract data type for online building and testing of an equivalence relation.

What it means in plain English

Union find supports 2 operations of a "world" of objects (their identity is unimportant). I use the connected component (graph theoretic) formulation here; it's easy to rephrase with equivalence relations

union(A,B)
Add an edge (undirected) to the graph between A and B.
find(A)
Find the connected component to which A belongs. That is, return an object which "represents" the component of A, in the sense that if B also belongs to the component of A then find(A)==find(B).
This data type is "online": you may freely mix the operations "union" and "find", and each "find" query will return an answer correct at the time of issuing.

Union find answers questions of the form "do I have a path from A to B in my graph right now?" very quickly. Storing the graph normally, such a query takes time linear in the number of objects. With union find, it takes the time to perform 2 finds (plus the time to check equality, typically taken to be O(1)).

Tarjan's algorithm union find with path compression achieves nearly constant amortized time complexity. The time to perform any sequence of n "union" or "find" operations is O(nβ(n)), where β(n) is a (known) function growing slower than the inverse of Ack(k,.) for any value of k. This is very slow indeed (slower than log or log*); a value of n for which β(n) > 6β(1) is unimaginably large!

A less optimal algorithm takes time O(n log n) for the same n operations, which is not nearly as good. However, if coded correctly for an application which performs many "find" operations, it may be faster!


printable version
chaos

algorithm log* Robert E. Tarjan Ackermann function
online algorithm Unification biconnected component amortized time complexity
connected component Union continuation passing style dynamic equivalence problem
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Drink up!
How can a good Buddhist work in advertising?
SPEWS
George W. Bush's address to the UN General Assembly: September 12, 2002
the knife edge of snowcrash
Doctor Faustus
Euclid's algorithm
Does porn increase the self-perceived value of pussy?
Thomas Shadwell
Darryl Strawberry
Ashurbanipal
integer information sample
Please Don't Bury Me
The Idiot's Guide to the Transmutation of Morals
New Writeups
XWiz
Trism(review)
artman2003
Briefcase Full of Souls - Part I(fiction)
Dreamvirus
Alan Ladd(person)
waverider37
Harold Holt(person)
The Debutante
Until death do us part(fiction)
Ysardo
a brother to a sister(personal)
antigravpussy
your warm whispers(personal)
Clarke
Multiculturalism(idea)
aneurin
Earl of Landaff(person)
Heitah
Pseudocide(idea)
XWiz
Google Knol(lede)
Mythi
July 24, 2008(personal)
locke baron
The fall of Earth(fiction)
BookReader
Fear the Cold(dream)
Pavlovna
Kathleen MacInnes(person)
This page courtesy of The Everything Development Company