Graph Kruskal's Algorithm
Graph Kruskal's Algorithm
Algorithm
Kruskal's algorithm to find the minimum cost spanning tree uses
the greedy approach. This algorithm treats the graph as a forest
and every node it has as an individual tree. A tree connects to
another only and only if, it has the least cost among all available
options and does not violate MST properties.
The least cost is 2 and edges involved are B,D and D,T. We add
them. Adding them does not violate spanning tree properties, so
we continue to our next edge selection.
Next cost is 3, and associated edges are A,C and C,D. We add
them again −
By adding edge S,A we have included all the nodes of the graph
and we now have minimum cost spanning tree.