1 / 10

Minimum Spanning tree

Minimum Spanning tree. Prim’s algorithm Select any vertex Select the shortest edge connected to that vertex Select the shortest edge which connects a previously chosen vertex to a new vertex Repeat step 3 until all vertices have been connected. Example.

ewa
Télécharger la présentation

Minimum Spanning tree

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. Minimum Spanning tree Prim’s algorithm Select any vertex Select the shortest edge connected to that vertex Select the shortest edge which connects a previously chosen vertex to a new vertex Repeat step 3 until all vertices have been connected

  2. Example A cable company want to connect five villages to their network which currently extends to the market town of Avenford. What is the minimum length of cable needed? 5 Brinleigh Cornwell 3 4 6 8 8 Avenford Donster Fingley 7 5 4 2 Edan

  3. Prim’s algorithm in tabular form First put the information from the network into a distance matrix

  4. Brinleigh 3 Avenford • Start at vertex A. Label column A “1” . • Delete row A • Select the smallest entry in column A (AB, length 3) 1

  5. Brinleigh 3 Avenford 4 Edan 1 2 • Label column B “2” • Delete row B • Select the smallest uncovered entry in either column A or column B (AE, length 4)

  6. Brinleigh 3 Avenford Donster 4 2 Edan 1 2 3 • Label column E “3” • Delete row E • Select the smallest uncovered entry in either column A, B or E (ED, length 2)

  7. Brinleigh Cornwell 3 4 Avenford Donster 4 2 Edan 1 2 4 3 • Label column D “4” • Delete row D • Select the smallest uncovered entry in either column A, B, D or E (DC, length 4)

  8. Brinleigh Cornwell 3 4 Fingley Avenford Donster 5 4 2 Edan 1 2 5 4 3 • Label column C “5” • Delete row C • Select the smallest uncovered entry in either column A, B, D, E or C (EF, length 5)

  9. Brinleigh Cornwell 3 4 Fingley Avenford Donster 5 4 2 Edan 1 2 5 4 3 6 • FINALLY • Label column F “6” • Delete row F

  10. Brinleigh Cornwell 3 4 Fingley Avenford Donster 5 4 2 Edan 1 2 5 4 3 6 • FINALLY • Label column F “6” • Delete row F The spanning tree is shown in the diagram Length 3 + 4 + 4 + 2 + 5 = 18Km

More Related