implementing kruskal alg for finding min span tree"