Prim’s Algorithm from a matrix A cable TV company is installing a system of cables to connect all the towns in the region. The numbers in the network are distances in miles. A D C B E F
Prim’s Algorithm from a matrix Show this graph in matrix form A D C B E F
Prim’s Algorithm from a matrix ABCDEF A B C D E F A dash (-) in the table means that there is no direct connection between these vertices.
Prim’s Algorithm from a matrix ABCDEF A B C D E F Choose a starting vertex say A. Delete row A and label column A with 1. Look for the smallest entry in column A 1
Prim’s Algorithm from a matrix ABCDEF A B C D E F Label column B with a 2. Delete row B. Now choose the smallest uncovered value from columns A or B 12
Prim’s Algorithm from a matrix ABCDEF A B C D E F Label column D with a 3. Delete row D. Now choose the smallest uncovered value from columns A or B or D 123
Prim’s Algorithm from a matrix ABCDEF A B C D E F Label column E with a 4. Delete row E. Now choose the smallest uncovered value from columns A or B or D or E 1234
Prim’s Algorithm from a matrix ABCDEF A B C D E F Label column C with a 5. Delete row C. Now choose the smallest uncovered value from columns A, B, D, E, or C 12345
Prim’s Algorithm from a matrix ABCDEF A B C D E F Label column F with a 6. We now have connected all the vertices into the spanning tree
Prim’s Algorithm from a matrix ABCDEF A B C D E F Length of the cabling = = 62 miles
Prim’s Algorithm from a matrix ABCDEF A B C D E F Length of the cabling = = 62 miles A B D C E F