Added union-find based connected components.
added a comment