(Latest Revision: Thu Mar 18 13:38:54 PDT 2021 )
Original list - the edges of a connected, undirected graph
{6, 7} 1
{1, 6} 2
{1, 7} 3
{4, 7} 4
{1, 4} 5
{5, 7} 6
{4, 5} 7
{5, 6} 8
{2, 3} 9
{3, 5} 10
{2, 5} 11
{1, 2} 12
{2, 7} 13
{3, 6} 14
{2, 4} 15
Execution of Kruskal's Algorithm,
showing the disjoint sets
{6, 7} 1 accept {6,7} {1} {2} {3} {4} {5}
{1, 6} 2 accept {1,6,7} {2} {3} {4} {5}
{1, 7} 3 reject {1,6,7} {2} {3} {4} {5}
{4, 7} 4 accept {1,4,6,7} {2} {3} {5}
{1, 4} 5 reject {1,4,6,7} {2} {3} {5}
{5, 7} 6 accept {1,4,5,6,7} {2} {3}
{4, 5} 7 reject {1,4,5,6,7} {2} {3}
{5, 6} 8 reject {1,4,5,6,7} {2} {3}
{2, 3} 9 accept {1,4,5,6,7} {2,3}
{3, 5} 10 accept {1,2,3,4,5,6,7}
{2, 5} 11
{1, 2} 12
{2, 7} 13
{3, 6} 14
{2, 4} 15
Kruskal List
The 6 accepted edges that form the min cost spanning tree,
in the order found, are:
{6, 7} 1
{1, 6} 2
{4, 7} 4
{5, 7} 6
{2, 3} 9
{3, 5} 10
The cost of the tree is 1+2+4+6+9+10 = 32
Execution of Prim's Algorithm, using the ordered list as an aid
{6, 7} 1 Prim #2 (cheapest edge leaving S={1,6}) Now S = {1,6,7}
{1, 6} 2 Prim #1 (cheapest edge leaving S={1}) Now S = {1,6}
{1, 7} 3
{4, 7} 4 Prim #3 (cheapest edge leaving S={1,6,7}) Now S = {1,4,6,7}
{1, 4} 5
{5, 7} 6 Prim #4 (cheapest edge leaving S={1,4,6,7}) Now S = {1,4,5,6,7}
{4, 5} 7
{5, 6} 8
{2, 3} 9 Prim #6 (cheapest edge leaving S={1,3,4,5,6,7}) Now S = {1,2,3,4,5,6,7}
{3, 5} 10 Prim #5 (cheapest edge leaving S={1,4,5,6,7}) Now S = {1,3,4,5,6,7}
{2, 5} 11
{1, 2} 12
{2, 7} 13
{3, 6} 14
{2, 4} 15
Prim List
The 6 accepted edges that form the min cost spanning tree,
in the order found, are:
{1, 6} 2
{6, 7} 1
{4, 7} 4
{5, 7} 6
{3, 5} 10
{2, 3} 9
The cost of the tree is 2+1+4+6+10+9 = 32