1 / 21

Dijkstra’s Algorithm with two levels of buckets

15.082J & 6.855J & ESD.78J Visualizations. Dijkstra’s Algorithm with two levels of buckets. ∞. ∞. 0. ∞. ∞. ∞. ∞. 2. 3. 4. 5. 6. Initialize. Initialize distance labels. 46. 2. 4. 8. 18. Initialize buckets. 22. 25. 26. 1. 6.

astro
Download Presentation

Dijkstra’s Algorithm with two levels of buckets

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. 15.082J & 6.855J & ESD.78JVisualizations Dijkstra’s Algorithm with two levels of buckets

  2. ∞ 0 ∞ ∞ ∞ ∞ 2 3 4 5 6 Initialize Initialize distance labels 46 2 4 8 18 Initialize buckets. 22 25 26 1 6 Select the first nonempty lower bucket. Then select an element of the bucket. 1 41 25 37 3 5 10-19 20-29 30-39 40-49 50-59 60-69 70-79 80-89 90-99 0 1 2 3 4 5 6 7 8 9 1

  3. 1 ∞ Update ∞ ∞ 8 Scan arcs out of node 1 and update data structures 46 2 4 8 18 0 22 25 26 ∞ 1 6 41 25 37 3 5 41 ∞ ∞ 10-19 20-29 30-39 40-49 50-59 60-69 70-79 80-89 90-99 2 3 4 0 1 2 3 4 5 6 7 8 9 5 1 6

  4. 1 ∞ Find Min Lower Bucket ∞ 8 Find min non-empty lower bucket. Select a node in the bucket. 46 2 4 2 8 18 0 22 25 26 ∞ 1 6 41 25 37 3 5 41 ∞ 10-19 20-29 30-39 40-49 50-59 60-69 70-79 80-89 90-99 3 4 0 1 2 3 4 5 6 7 8 9 5 2 6

  5. 1 ∞ Update ∞ 8 54 Scan arcs out of node 2 and update distance labels and buckets. 46 2 4 2 8 18 0 22 25 26 ∞ 1 6 41 25 37 3 5 33 30 41 ∞ 10-19 20-29 30-39 40-49 50-59 60-69 70-79 80-89 90-99 3 4 0 1 2 3 4 5 6 7 8 9 5 2 6

  6. 1 ∞ Find Min Lower Bucket 54 8 Scan lower bucket for first non-empty bucket. If none exist, then go to scanning upper buckets. 46 2 4 2 8 18 0 22 25 26 ∞ 1 6 41 25 37 3 5 33 30 10-19 20-29 30-39 40-49 50-59 60-69 70-79 80-89 90-99 3 4 5 0 1 2 3 4 5 6 7 8 9 6

  7. 1 ∞ Find Min Upper Bucket 54 8 Scan upper buckets to find the first non-empty bucket. 46 2 4 2 8 18 0 22 25 26 ∞ 1 6 41 25 37 3 5 33 30 10-19 20-29 30-39 40-49 50-59 60-69 70-79 80-89 90-99 3 4 5 0 1 2 3 4 5 6 7 8 9 6

  8. 1 ∞ Move contents down 54 8 Adjust bucket numbers of lower buckets and move contents of upper bucket to lower buckets 46 2 4 2 8 18 0 22 25 26 ∞ 1 6 41 25 37 3 5 33 30 30-39 40-49 50-59 60-69 70-79 80-89 90-99 3 4 5 30 0 1 31 32 2 3 33 4 34 5 35 6 36 7 37 8 38 9 39 6

  9. 1 ∞ Find Min Lower Bucket 54 8 Find the first nonempty lower bucket and select a node in the bucket 46 2 4 2 8 18 0 22 25 26 ∞ 1 6 41 25 37 3 5 5 33 30 40-49 50-59 60-69 70-79 80-89 90-99 4 30 31 32 33 34 35 36 37 38 39 5 3 6

  10. 1 ∞ Update 54 8 Scan arcs out of node 5 and update distance labels and buckets. 46 2 4 2 8 18 0 22 25 26 ∞ 1 6 41 55 25 37 3 5 5 33 30 40-49 50-59 60-69 70-79 80-89 90-99 4 30 31 32 33 34 35 36 37 38 39 5 3 6

  11. 1 Find Min Lower Bucket 54 8 Find the first nonempty lower bucket and select a node in the bucket 46 2 4 2 8 18 0 22 25 26 1 6 41 55 25 37 3 5 3 5 33 30 40-49 50-59 60-69 70-79 80-89 90-99 4 6 30 31 32 33 34 35 36 37 38 39 3

  12. 1 Update 54 8 Scan arcs out of node 3 and perform updates. 46 2 4 2 8 18 0 22 25 26 1 6 41 55 25 37 3 5 3 5 33 30 40-49 50-59 60-69 70-79 80-89 90-99 4 6 30 31 32 33 34 35 36 37 38 39 3

  13. 1 Find Min Lower Bucket 54 8 Scan lower buckets looking for a non-empty bucket. 46 2 4 2 8 18 0 22 25 26 1 6 41 55 25 37 3 5 5 33 30 40-49 50-59 60-69 70-79 80-89 90-99 4 6 30 31 32 33 34 35 36 37 38 39

  14. 1 Find Min Upper Bucket 54 8 Scan upper buckets looking for a non-empty bucket. 46 2 4 2 8 18 0 22 25 26 1 6 41 55 25 37 3 5 5 33 30 40-49 50-59 60-69 70-79 80-89 90-99 4 6 30 31 32 33 34 35 36 37 38 39

  15. 1 Move contents down 54 8 Adjust bucket numbers of lower buckets and move contents of upper bucket to lower buckets. 46 2 4 2 8 18 0 22 25 26 1 6 41 55 25 37 3 5 5 33 30 50-59 60-69 70-79 80-89 90-99 4 6 30 50 51 31 32 52 33 53 34 54 35 55 36 56 37 57 58 38 59 39

  16. 1 Find Min Lower Bucket 54 8 Select the min non-empty lower bucket. Select an element from the bucket. 46 2 4 2 4 8 18 0 22 25 26 1 6 41 55 25 37 3 5 5 33 30 60-69 70-79 80-89 90-99 50 51 52 53 54 55 56 57 58 59 4 6

  17. 1 Update 54 8 Scan arcs out of node 4 and perform all updates. 46 2 4 2 4 8 18 0 22 25 26 1 6 41 55 25 37 3 5 5 33 30 60-69 70-79 80-89 90-99 50 51 52 53 54 55 56 57 58 59 4 6

  18. 1 Find Min Lower Bucket 54 8 Scan lower buckets looking for a non-empty bucket. Select a node of the bucket 46 2 4 2 6 8 18 0 22 25 26 1 6 41 55 25 37 3 5 5 33 30 60-69 70-79 80-89 90-99 50 51 52 53 54 55 56 57 58 59 6

  19. 1 Update 54 8 Scan arcs out of node 6, and perform updates 46 2 4 2 6 8 18 0 22 25 26 1 6 41 55 25 37 3 5 5 33 30 60-69 70-79 80-89 90-99 50 51 52 53 54 55 56 57 58 59 6

  20. 1 Termination 54 8 All nodes are permanent. The algorithm terminates with the optimal shortest path tree. 46 2 4 2 8 18 0 22 25 26 1 6 41 55 25 37 3 5 5 33 30 60-69 70-79 80-89 90-99 50 51 52 53 54 55 56 57 58 59

  21. MITOpenCourseWare http://ocw.mit.edu 15.082J / 6.855J / ESD.78J Network Optimization Fall 2010 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

More Related