Quick weighted union find for connected components.