Download presentation
Presentation is loading. Please wait.
Published byΘεοδώρα Βέργας Modified over 6 years ago
1
Dijkstra’s Algorithm with two levels of buckets
15.082J & 6.855J & ESD.78J Visualizations Dijkstra’s Algorithm with two levels of buckets Obtain a network, and use the same network to illustrate the shortest path problem for communication networks, the max flow problem, the minimum cost flow problem, and the multicommodity flow problem. This will be a very efficient way of introducing the four problems. (Perhaps under 10 minutes of class time.)
2
Initialize ∞ ∞ Initialize distance labels Initialize buckets.
∞ Initialize distance labels 46 2 4 8 18 Initialize buckets. 22 25 26 1 1 6 Select the first nonempty lower bucket. Then select an element of the bucket. 41 25 37 3 5 ∞ 10-19 20-29 30-39 40-49 50-59 60-69 70-79 80-89 90-99 2 3 4 5 6 1 2 3 4 5 6 7 8 9 1
3
Update ∞ ∞ 8 Scan arcs out of node 1 and update data structures 46 2 4 8 18 22 1 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 1 2 3 4 5 6 7 8 9 4 5 1 6
4
Find Min Lower Bucket ∞ ∞ ∞ ∞ 8
Find min non-empty lower bucket. Select a node in the bucket. 46 2 2 4 8 18 22 1 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 1 2 3 4 5 6 7 8 9 4 5 2 6
5
Update ∞ 8 54 Scan arcs out of node 2 and update distance labels and buckets. 46 2 2 4 8 18 22 1 25 26 ∞ 1 6 41 25 37 33 3 5 30 41 ∞ ∞ 10-19 20-29 30-39 40-49 50-59 60-69 70-79 80-89 90-99 3 1 2 3 4 5 6 7 8 9 4 5 2 6
6
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 2 4 8 18 22 1 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 1 2 3 4 5 6 7 8 9 6
7
Find Min Upper Bucket ∞ ∞ 54 8
Scan upper buckets to find the first non-empty bucket. 46 2 2 4 8 18 22 1 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 1 2 3 4 5 6 7 8 9 6
8
Move contents down 54 8 Adjust bucket numbers of lower buckets and move contents of upper bucket to lower buckets 46 2 2 4 8 18 22 1 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 1 2 3 4 5 6 7 8 9 30 31 32 33 34 35 36 37 38 39 6
9
Find Min Lower Bucket ∞ ∞ 54 8
Find the first nonempty lower bucket and select a node in the bucket 46 2 2 4 8 18 22 1 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
Update 54 8 Scan arcs out of node 5 and update distance labels and buckets. 46 2 2 4 8 18 22 1 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
Find Min Lower Bucket 54 8 Find the first nonempty lower bucket and select a node in the bucket 46 2 2 4 8 18 22 1 25 26 1 6 41 55 25 37 3 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 3
12
Update 54 8 Scan arcs out of node 3 and perform updates. 55 33 30 4 6
46 2 2 4 8 18 22 1 25 26 1 6 41 55 25 37 3 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 3
13
Find Min Lower Bucket 54 8 Scan lower buckets looking for a non-empty bucket. 46 2 2 4 8 18 22 1 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
Find Min Upper Bucket 54 8 Scan upper buckets looking for a non-empty bucket. 46 2 2 4 8 18 22 1 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
Move contents down 54 8 Adjust bucket numbers of lower buckets and move contents of upper bucket to lower buckets. 46 2 2 4 8 18 22 1 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 50 51 52 53 54 55 56 57 58 59 30 31 32 33 34 35 36 37 38 39
16
Find Min Lower Bucket 54 8 Select the min non-empty lower bucket. Select an element from the bucket. 46 2 2 4 4 8 18 22 1 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
Update 54 8 Scan arcs out of node 4 and perform all updates. 55 33 30
46 2 2 4 4 8 18 22 1 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
Find Min Lower Bucket 54 8 Scan lower buckets looking for a non-empty bucket. Select a node of the bucket 46 2 2 4 8 18 22 1 25 26 1 6 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
Update 54 8 Scan arcs out of node 6, and perform updates 55 33 30 50
46 2 2 4 8 18 22 1 25 26 1 6 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
Termination 54 8 All nodes are permanent. The algorithm terminates with the optimal shortest path tree. 46 2 2 4 8 18 22 1 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
15.082J / 6.855J / ESD.78J Network Optimization
MITOpenCourseWare 15.082J / 6.855J / ESD.78J Network Optimization Fall 2010 For information about citing these materials or our Terms of Use, visit:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.