Finding the connected components of a graph.
Connected-Components(Graph) foreach v in vertices(Graph) Make-Set(v) foreach e in edges(Graph) (u,v) = e if Find-Set(u) Find-Set(v) then Union(u,v)
Same-Component(u,v) if Find-Set(u) = Find-Set(v) then return True else return False