Introduction - If you have any usage issues, please Google them yourself
Use kruskal algorithm to generate the minimum spanning tree, the edge of the input according to the weight, size of each edge endpoints belong to different collections, elected to take an edge of two endpoints with belongs to a collection, this side to give up. Do not belong to the same collection is merged.