1 / 6

Dijkstra’s (Shortest Path Algorithm)

Dijkstra’s (Shortest Path Algorithm). How to do it. 1.Label the starting vertex S & circle it. Examine all edges that have S as an end point. Darken the edge w/ the shortest length & circle the vertex at the other endpoint.

tanuja
Download Presentation

Dijkstra’s (Shortest Path Algorithm)

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. Dijkstra’s (Shortest Path Algorithm)

  2. How to do it 1.Label the starting vertex S & circle it. Examine all edges that have S as an end point. Darken the edge w/ the shortest length & circle the vertex at the other endpoint. 2. Examine all uncircled vertices that are adjacent to the circled vertices in the graph. 3. Find the length of every path between S an uncircled. Select the shortest path. 4. Repeat until all vertices are circled.

  3. EXAMPLEFind shortest path from A to F in the graph. C 6 E 2 3 A 52 4 54 F B 3 D FDFF;.JK\

  4. Step4 Step3 Step 1 C 6 E 2 3 A 52 4 54 F B 3 D Step 2 Step 5 The shortest route from A to F is A, C, D, F, & the length is 10. FDFF;.JK\

  5. Adjacent vertices Path from x to vertex length of path Adjacent to S B SB 5 C SC 2 1.CIRCLE C, DARKEN EDGE SC. Adjacent to S B SB 5 Adjacent to C B SCB 4 E SCE 8 D SCD 6 2.CIRCLE B, DARKEN EDGE CB. Adjacent to C E SCE 8 D SCD 6 Adjacent to B D SCBD 7 3.CIRCLE D, DARKENEDGE CD. Adjacent to C E SCE 8 Adjacent to D E SCDE 11 F SCDF 10

  6. Adjacent vertices Path from x to vertex length of path 4.CIRCLE E, DARKEN EDGE CE.Adjacent to E F SCEF 11Adjacent to D F SCDF 105.CIRCLE F, DARKEN EDGE DF.

More Related