Prim's Algorithm
Prim's Algorithm
We have already seen Kruskal's Algorithm a useful way to find a minimum weighted spanning tree. We will now briefly describe another algorithm called Prim's algorithm which achieves the same results.
Steps to Prim's Algorithm
Step 1 | First begin with any vertex in the graph. |
---|---|
Step 2 | Of all of the edges incident to this vertex, select the edge with the smallest weight. |
Step 3 | Repeat step 2 using the edges incident with the new vertex and that aren't already drawn. Repeat until a spanning tree is created. |