Kruskal's algorithm is a greedy MST algorithm. It initially sorts all the edges of the graph in
ascending order of their weights into an edge queue. At each step, the edge at the front of
the edge queue (lowest weight) is popped from the edge queue. If adding this edge does not create a cycle
in the current MST, it is added to the MST, else it is discarded. This keeps repeating until the
MST has V - 1 edges, where V is the number of nodes/vertices in the graph.
Look below for an example run of Kruskal's algorithm: