1 / 20

Find shortest path from s to t.

Dijkstra's Shortest Path Algorithm (from “Algorithm Design” by J.Kleinberg and E.Tardos). Find shortest path from s to t. 2. 24. 3. 9. s. 18. 14. 6. 2. 6. 4. 19. 30. 11. 5. 15. 5. 6. 16. 20. t. 7. 44. Dijkstra's Shortest Path Algorithm. S = { }

Download Presentation

Find shortest path from s to t.

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 (from “Algorithm Design” by J.Kleinberg and E.Tardos) • Find shortest path from s to t. 2 24 3 9 s 18 14 6 2 6 4 19 30 11 5 15 5 6 16 20 t 7 44

  2. Dijkstra's Shortest Path Algorithm S = { } PQ = { s, 2, 3, 4, 5, 6, 7, t }   2 24 3 0 9 s 18  14 6 2 6  4  19 30 11 5 15 5 6 16 20 t 7 44  distance label 

  3. Dijkstra's Shortest Path Algorithm S = { } PQ = { s, 2, 3, 4, 5, 6, 7, t } delmin   2 24 3 0 9 s 18  14 6 2 6  4  19 30 11 5 15 5 6 16 20 t 7 44  distance label 

  4. Dijkstra's Shortest Path Algorithm S = { s } PQ = { 2, 3, 4, 5, 6, 7, t } decrease key   9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  4  19 30 11 5 15 5 6 16 20 t 7 44  distance label  15 X

  5. Dijkstra's Shortest Path Algorithm S = { s } PQ = { 2, 3, 4, 5, 6, 7, t } delmin   9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  4  19 30 11 5 15 5 6 16 20 t 7 44  distance label  15 X

  6. Dijkstra's Shortest Path Algorithm S = { s, 2 } PQ = { 3, 4, 5, 6, 7, t }   9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  4  19 30 11 5 15 5 6 16 20 t 7 44   15 X

  7. Dijkstra's Shortest Path Algorithm S = { s, 2 } PQ = { 3, 4, 5, 6, 7, t } decrease key  33 X  9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  4  19 30 11 5 15 5 6 16 20 t 7 44   15 X

  8. Dijkstra's Shortest Path Algorithm S = { s, 2 } PQ = { 3, 4, 5, 6, 7, t }  33 X  9 X 2 24 3 0 9 delmin s 18  14 X 14 6 2 6  4  19 30 11 5 15 5 6 16 20 t 7 44   15 X

  9. Dijkstra's Shortest Path Algorithm S = { s, 2, 6 } PQ = { 3, 4, 5, 7, t } 32  33 X X  9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  44 4  X 19 30 11 5 15 5 6 16 20 t 7 44   15 X

  10. Dijkstra's Shortest Path Algorithm S = { s, 2, 6 } PQ = { 3, 4, 5, 7, t } 32  33 X X  9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  44 4  X 19 30 11 5 15 5 6 16 20 t 7 44  delmin  15 X

  11. Dijkstra's Shortest Path Algorithm S = { s, 2, 6, 7 } PQ = { 3, 4, 5, t } 32  33 X X  9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  35 44 X 4  X 19 30 11 5 15 5 6 16 20 t 7 44  59 X  15 X

  12. Dijkstra's Shortest Path Algorithm S = { s, 2, 6, 7 } PQ = { 3, 4, 5, t } delmin 32  33 X X  9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  35 44 X 4  X 19 30 11 5 15 5 6 16 20 t 7 44  59 X  15 X

  13. Dijkstra's Shortest Path Algorithm S = { s, 2, 3, 6, 7 } PQ = { 4, 5, t } 32  33 X X  9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  35 34 44 X X 4  X 19 30 11 5 15 5 6 16 20 t 7 44  51 59 X X  15 X

  14. Dijkstra's Shortest Path Algorithm S = { s, 2, 3, 6, 7 } PQ = { 4, 5, t } 32  33 X X  9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  35 34 44 X X 4  X 19 30 11 5 15 5 6 16 delmin 20 t 7 44  51 59 X X  15 X

  15. Dijkstra's Shortest Path Algorithm S = { s, 2, 3, 5, 6, 7 } PQ = { 4, t } 32  33 X X  9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  45 35 34 X 44 X X 4  X 19 30 11 5 15 5 6 16 20 t 7 44  50 51 59 X X X  15 X

  16. Dijkstra's Shortest Path Algorithm S = { s, 2, 3, 5, 6, 7 } PQ = { 4, t } 32  33 X X  9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  45 35 34 X 44 X X 4  X 19 30 11 5 delmin 15 5 6 16 20 t 7 44  50 51 59 X X X  15 X

  17. Dijkstra's Shortest Path Algorithm S = { s, 2, 3, 4, 5, 6, 7 } PQ = { t } 32  33 X X  9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  45 35 34 X 44 X X 4  X 19 30 11 5 15 5 6 16 20 t 7 44  50 51 59 X X X  15 X

  18. Dijkstra's Shortest Path Algorithm S = { s, 2, 3, 4, 5, 6, 7 } PQ = { t } 32  33 X X  9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  45 35 34 X 44 X X 4  X 19 30 11 5 15 5 6 16 20 t 7 44  delmin 50 51 59 X X X  15 X

  19. Dijkstra's Shortest Path Algorithm S = { s, 2, 3, 4, 5, 6, 7, t } PQ = { } 32  33 X X  9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  45 35 34 X 44 X X 4  X 19 30 11 5 15 5 6 16 20 t 7 44  50 51 59 X X X  15 X

  20. Dijkstra's Shortest Path Algorithm S = { s, 2, 3, 4, 5, 6, 7, t } PQ = { } 32  33 X X  9 X 2 24 3 0 9 s 18  14 X 14 6 2 6  45 35 34 X 44 X X 4  X 19 30 11 5 15 5 6 16 20 t 7 44  50 51 59 X X X  15 X

More Related