Add kruskal algorithm