Prim's Algorithm
Prim's Algorithm
STEP: 1 – Choose an arbitrary starting Vertex. STEP: 2 – Keep including connected edges
Here, we will begin with vertex A with minimal cost.
We will choose B as edge AB has
minimum edge weight.
Finding MST with Prim’s Algorithm
We must consider all the edges that are visible from all
the already discovered vertices. From vertex B we will
choose vertex C as it has minimum cost .
Finding MST with Prim’s Algorithm
So,
The cost for this MST G’(V’,E’) is = Summation of all the edge weights of MST
= 7 +5+2+1+3+5+6+10
Hence, the Minimum Cost of Spanning Tree is 39.