Improved KruskalMinimumSpanningTree().