Keywords: Prim's algorithm.svg en Demonstration of Prim's algorithm starting at the vertex A Tree edges are highlighted in red candidates for the next edge are in black and non-candidates are in grey The set of vertices joined to the tree so far is in black while those not yet joined are in grey The algorithm starts by choosing the cheapest edge out of A then choosing the cheapest edge between A D and B C there are two of weight 2 and BD is chosen arbitrarily In the next step the edge AB is no longer a candidate because it now joins two nodes already in the tree and the only edge remaining to be added is CD own User Dcoetzee 2013-11-15 Cc-zero Graph algorithms |