Implemented kruskal's algorithm for MSF