used a different function call in kruskal's algorithm.