A second way to find a minimum spanning tree is to use Prim’s algorithm.
Key point 2.6 Prim’s algorithm: Start with any node (this will usually be given in the question). Step 1: Add an arc of minimum weight joining a node already included to a node not already included.
Tip
PL E
Step 2: If a spanning tree is obtained stop; otherwise return to Step 1.
Prim’s algorithm builds a tree by growing out from the starting node until every node is included.
WORKED EXAMPLE 2.4
SA
M
Use Prim’s algorithm, starting at A, to find a minimum spanning tree for this network.
AB = 5
BD = 3 BC = 6
Choose AB
= 5
, the least weight arc from {A} to {B, C , D, E, F , G, H }.
Choose BD
= 3
, the least weight arc from {A, B} to {C , D, E, F , G, H }. Choose BC = 6 (or DE = 6), a least weight arc from {A, B, D} to {C , E, F , G, H }.
Note that the arc can start at any of the nodes already included. AB = 5 BD = 3 BC = 6 CE = 2
Continue in this way until a spanning tree is obtained. Add the weights of the arcs that have been used to find the total weight of the spanning tree. The working should all be shown on one diagram. The list is evidence that you have used the algorithm correctly.
Original material © Cambridge University Press 2018