Prim’s algorithm (also known as Jarník’s algorithm) is a greedy algorithm that finds a minimum spanning tree for a weighted undirected graph. Full Wikipedia Definition Here.
Example of Prim’s Algorithm
Remove all the Loops. Loop is going from the Same vertex and coming to the same vertext. In example above vertex F has loop. Remove that.
Remove all Parallel Edges. In above example from vertex B there are two edges going into vertex D. Remove the Edge which has greater weight. In above case remove edge with weight 8.
To read more visit https://hecodesit.com/prims-algorithm/
Top comments (0)