DS – Cost of Minimum Spanning Tree

Finding the cost of Minimum spanning tree:

  • The given graph can be cyclic.
  • Spanning tree cannot be cyclic
  • One Spanning tree can give multiple costs depends on the cost of each edge.

We can find the minimum cost of spanning tree using number of algorithms.

  • Prim’s algorithm
  • Kruskal’s algorithm

Prim’s algorithm:

Find the minimum cost for this graph:

Find the minimum cost for this graph:

Scroll to Top