added kruskal algorithm with union-find