algorithm of Kruskal