Minimum Spanning Tree in Data Structures (1)
Minimum Spanning Tree in Data Structures (1)
A spanning tree is a subset of an undirected Graph that has all the vertices connected
by minimum number of edges.
If all the vertices are connected in a graph, then there exists at least one spanning tree.
In a graph, there may exist more than one spanning tree.
As we have discussed, one graph may have more than one spanning tree. If there are n
number of vertices, the spanning tree should have n - 1 number of edges. In this
context, if each edge of the graph is associated with a weight and there exists more than
one spanning tree, we need to find the minimum spanning tree of the graph.
Moreover, if there exist any duplicate weighted edges, the graph may have multiple
minimum spanning tree.
In the above graph, we have shown a spanning tree though it’s not the minimum
spanning tree. The cost of this spanning tree is (5 + 7 + 3 + 3 + 5 + 8 + 3 + 4) = 38.