1 / 66

Lecture 6

Lecture 6. Shortest Path Problem. Quiz Sample. True or False Every dynamic programming can be analyzed with formula: Run-time = (table size) x (computation time of recursive formula). Answer: False A counterexample can be seen in study of the shortest path problem.

jarrede
Download Presentation

Lecture 6

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. Lecture 6 Shortest Path Problem

  2. Quiz Sample • True or False • Every dynamic programming can be analyzed with formula: • Run-time = (table size) • x (computation time of recursive formula). • Answer: False • A counterexample can be seen in study of the shortest path problem.

  3. s t

  4. Dynamic Programming

  5. Dynamic Programming

  6. Dynamic Programming

  7. Dijkstra’s Algorithm Find the shortest path from a network with nonnegative edge weights.

  8. Dijkstra’s Algorithm

  9. Lemma

  10. Lemma

  11. Proof of Lemma T w u S s

  12. Dijkstra’s Algorithm

  13. 1 An Example   4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5   Initialize Select the node with the minimum temporary distance label.

  14. Update Step 2   4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5   4

  15. Choose Minimum Temporary Label 2  4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5  4

  16. Update Step 6 2  4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5  4 4 3 The predecessor of node 3 is now node 2

  17. Choose Minimum Temporary Label 2 6 4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5 3 4

  18. Update 2 6 4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5 3 4 d(5) is not changed.

  19. Choose Minimum Temporary Label 2 6 4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5 3 4

  20. Update 2 6 4 2 4 2 2 0 6 2 1 3  1 6 4 2 3 3 5 3 4 d(4) is not changed

  21. Choose Minimum Temporary Label 2 6 4 2 4 2 2 0 2 1 3 6 1 6 4 2 3 3 5 3 4

  22. Update 2 6 4 2 4 2 2 0 2 1 3 6 1 6 4 2 3 3 5 3 4 d(6) is not updated

  23. Choose Minimum Temporary Label 2 6 4 2 4 2 2 0 2 1 3 6 1 6 4 2 3 3 5 3 4 There is nothing to update

  24. End of Algorithm 2 6 4 2 4 2 2 0 2 1 3 6 1 6 4 2 3 3 5 3 4 All nodes are now permanent The predecessors form a tree The shortest path from node 1 to node 6 can be found by tracing back predecessors

  25. Theorem

  26. Counterexample 4 -2 -2 2 1

  27. Counterexample 3 -2 -2 1 2

  28. Counterexample 4 -2 -2 1 2

  29. Counterexample 4 -2 -2 1 2

  30. Counterexample 4 -2 -2 1 2

  31. Dijkstra’s Algorithm with simple buckets (also known as Dial’s algorithm)

  32.  0  1    2 0 1 2 3 4 5 6 7 3 4 5 6 An Example Initialize distance labels 4 2 4 2 2 Initialize buckets. 2 1 3 1 6 4 2 3 Select the node with the minimum temporary distance label. 3 5 1

More Related