adds Kruskal's algorithm for minimum spanning tree