Prim
Prim
23BKT031
Prim's Algorithm
A Prim’s algorithm comes under a greedy algorithm and is used to
discover the minimum spanning tree from a graph.
Beginning with a single node, Prim’s algorithm analyses each
subsequent node along with all of its associated edges, with one
vertex, we continue to add edges with the lowest weight until we
attain our objective.
• Algorithm
• Stage 1: Choose a starting vertex
• Stage 2: Repetition of Steps 3 and 4 until the fringe vertex is present.
• Stage 3: Choose an edge with a minimum weight that connects the
tree vertex and the fringe vertex.
• Stage 4: Include the chosen vertex and edge in the least spanning
tree T.
• [FINISH OF LOOP]
• Stage 5: EXIT