Contents    Page-10    Prev    Next    Page+10    Index   

Prim's Algorithm

Prim's Algorithm for finding a minimum spanning tree is similar to Dijkstra's Algorithm for shortest paths. The basic idea is to start with a part of the tree (initially, one node of the graph) and add the lowest-cost arc between the existing tree and another node that is not part of the tree.

As with Dijkstra's Algorithm, each node has a parent node pointer and a cost, which is the least cost of an arc connecting to the tree that has been found so far.