Implemented Kruskal algorithm and cycle detection to
UndirectedWeightedGraph