New Start Day 10: 09/10/2020 Learning Krukshal

Krukshal Algorithm It is an algorithm to find the minimum spanning tree of a graph. A tree that includes all the nodes and n-1 edges with minimum overall weight. The way I applied Krukshal's algorithm at start was that I sorted every edge and picked them one by one. If I got an edge where both of the vertices were already added I would discard it. If I got an edge where only one was added then I would add the edge and count the other vertex. If I encountered with an edge where none of the vertices were added I would count both of them and do it until I got all the vertices but it had a flaw. I wasn't concerned if these edges were connected to each other in any way. let's say I could get a graph with nodes connected in pairs and not connected to each other. Now I learned Krukshal using geeks for geeks. Two most important functions that fixed my flaw are explained with the code. Source(https://www.geeksforgeeks.org/kruskals-minimum-spanning-tree-using-stl-in-c/) // C++ progr...