1 / 11

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. F. Prim’s Algorithm from a matrix. 20. 19. 12. D. E. 10. 15. 13. 12. 8. 14. A. C. B. Show this graph in matrix form. F.

oswald
Download Presentation

Prim’s Algorithm from a matrix

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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. F Prim’s Algorithm from a matrix 20 19 12 D E 10 15 13 12 8 14 A C B

  2. Show this graph in matrix form F Prim’s Algorithm from a matrix 20 19 12 D E 10 15 13 12 8 14 A C B

  3. Prim’s Algorithm from a matrix A dash (-) in the table means that there is no direct connection between these vertices.

  4. 1 Prim’s Algorithm from a matrix 1. Choose a starting vertex say A. Delete row A and label column A with 1. Look for the smallest entry in column A

  5. 1 2 Prim’s Algorithm from a matrix 2. Label column B with a 2. Delete row B. Now choose the smallest uncovered value from columns A or B

  6. 1 2 3 Prim’s Algorithm from a matrix 3. Label column D with a 3. Delete row D. Now choose the smallest uncovered value from columns A or B or D

  7. 1 2 3 4 Prim’s Algorithm from a matrix 4. Label column E with a 4. Delete row E. Now choose the smallest uncovered value from columns A or B or D or E

  8. 1 2 5 3 4 Prim’s Algorithm from a matrix 5. Label column C with a 5. Delete row C. Now choose the smallest uncovered value from columns A, B, D, E, or C

  9. 1 2 5 3 4 6 Prim’s Algorithm from a matrix 5. Label column F with a 6. We now have connected all the vertices into the spanning tree.

  10. 1 2 5 3 4 6 Prim’s Algorithm from a matrix Length of the cabling = 8 + 10 + 12 + 13 + 19 = 62 miles

  11. 1 2 5 3 4 6 F Prim’s Algorithm from a matrix 19 D 12 E 10 13 C A 8 B Length of the cabling = 8 + 10 + 12 + 13 + 19 = 62 miles

More Related