union find implementation for connected components, close #62