Complete Kruskal Algorithm.