180 likes | 188 Views
15.082J & 6.855J & ESD.78J. Radix Heap Animation. ∞. ∞. 5. 2. 4. 15. 2. 13. 0. ∞. 1. 6. 20. 0. 8. 9. 3. 5. ∞. ∞. ∞. An Example from AMO (with a small change). Initialize distance labels. Initialize buckets and their ranges. Insert nodes into buckets. 2-3. 4-7. 8-15.
E N D
15.082J & 6.855J & ESD.78J Radix Heap Animation
∞ ∞ 5 2 4 15 2 13 0 ∞ 1 6 20 0 8 9 3 5 ∞ ∞ ∞ An Example from AMO (with a small change) Initialize distance labels Initialize buckets and their ranges. Insert nodes into buckets. 2-3 4-7 8-15 16-31 32-63 0 1 2 3 1 4 5 6
5 2 4 15 2 13 1 6 20 0 8 9 3 5 ∞ Find Min Bucket ∞ ∞ Find Min Non-Empty Bucket If the bucket has width 1 or a single element then select a node of the bucket. 0 ∞ 1 ∞ ∞ 2-3 4-7 8-15 16-31 32-63 0 1 2 3 1 4 5 6
∞ Update ∞ ∞ 13 15 Scan arcs out of node 1. 5 2 4 15 2 13 0 ∞ Update the distance labels and buckets. 1 1 6 20 0 8 9 3 5 ∞ ∞ 0 20 2-3 4-7 8-15 16-31 32-63 0 1 2 3 1 4 5 6
∞ Find Min Bucket ∞ ∞ 13 15 Find Min Non-Empty Bucket 5 2 4 15 2 13 If the bucket has width 1 or a single element then select a node of the bucket. 0 ∞ 1 1 6 20 0 8 9 3 3 5 ∞ ∞ 0 20 2-3 4-7 8-15 16-31 32-63 0 1 3 2 5 4 6
∞ Update ∞ ∞ 13 15 Scan arcs out of node 3 and update distances and buckets. 5 2 4 15 2 13 0 ∞ 1 1 6 20 0 8 9 3 3 5 ∞ 0 20 9 2-3 4-7 8-15 16-31 32-63 0 1 3 2 5 4 6
∞ Find Min Bucket ∞ ∞ 13 15 Find Min Non-Empty Bucket 5 2 4 15 2 13 If the bucket has width 1 or a single element then select a node of the bucket. Else, redistribute the range of the bucket. 0 ∞ 1 1 6 20 0 8 9 3 5 ∞ 0 20 9 9 10 11-12 2-3 13-15 4-7 8-15 16-31 32-63 0 1 2 5 4 6
∞ Find Min Bucket ∞ ∞ 13 15 Find Min Non-Empty Bucket 5 2 4 15 2 13 If the bucket has width 1 or a single element then select a node of the bucket. 0 ∞ 1 1 6 20 0 8 9 5 3 5 ∞ 0 20 9 9 10 11-12 2-3 13-15 4-7 8-15 16-31 32-63 0 1 2 5 4 6
∞ Update ∞ ∞ 13 15 Scan arcs out of node 5 and update distances and buckets. 5 2 4 15 2 13 17 0 ∞ 1 1 6 20 0 8 9 5 3 5 ∞ 0 20 9 9 10 11-12 2-3 13-15 4-7 8-15 16-31 32-63 0 1 2 5 4 6
Find Min Bucket ∞ ∞ 13 15 Find Min Non-Empty Bucket 5 2 4 15 2 13 If the bucket has width 1 or a single element then select a node of the bucket. Else, redistribute the range of the bucket. 17 0 ∞ 1 1 6 20 0 8 9 3 5 ∞ 0 9 20 9 13 10 14 15 11-12 2-3 13-15 4-7 8-15 16-31 32-63 0 1 2 6 4
Find Min Bucket ∞ ∞ 13 15 Find Min Non-Empty Bucket 5 2 2 4 15 2 13 If the bucket has width 1 or a single element then select a node of the bucket. 17 0 ∞ 1 1 6 20 0 8 9 3 5 ∞ 0 9 20 13 9 14 10 15 11-12 2-3 13-15 4-7 8-15 16-31 32-63 0 1 2 6 4
Update ∞ ∞ 13 15 Scan arcs out of node 5 and update distances and buckets. 5 2 2 4 15 2 13 17 0 ∞ 1 1 6 20 0 8 9 3 5 ∞ 0 9 20 13 9 10 14 15 11-12 2-3 13-15 4-7 8-15 16-31 32-63 0 1 2 6 4
Find Min Bucket ∞ ∞ 13 15 Find Min Non-Empty Bucket 5 4 2 4 15 2 13 If the bucket has width 1 or a single element then select a node of the bucket. 17 0 ∞ 1 1 6 20 0 8 9 3 5 ∞ 0 9 20 13 9 10 14 15 11-12 2-3 13-15 4-7 8-15 16-31 32-63 0 1 6 4
Update ∞ ∞ 13 15 Scan arcs out of node 4 and update distances and buckets. 5 4 2 4 15 2 13 17 0 ∞ 1 1 6 20 0 8 9 3 5 ∞ 0 20 9 13 9 14 10 11-12 15 2-3 13-15 4-7 8-15 16-31 32-63 0 1 6 4
Find Min Bucket ∞ ∞ 13 15 Find Min Non-Empty Bucket 5 2 4 15 2 13 If the bucket has width 1 or a single element then select a node of the bucket. 17 0 ∞ 6 1 1 6 20 0 8 9 3 5 ∞ 0 9 20 9 13 10 14 11-12 15 2-3 13-15 4-7 8-15 16-31 32-63 0 1 6
Update ∞ ∞ 13 15 Scan arcs out of node 4 and update distances and buckets. 5 2 4 15 2 13 17 0 ∞ 6 1 1 6 20 0 8 9 3 5 ∞ 0 20 9 13 9 14 10 15 11-12 2-3 13-15 4-7 8-15 16-31 32-63 0 1 6
Termination ∞ ∞ 13 15 All nodes are permanently labeled. The algorithm terminates 5 2 4 15 2 13 17 0 ∞ 1 1 6 20 0 8 9 3 5 ∞ 0 20 9 9 13 14 10 15 11-12 2-3 13-15 4-7 8-15 16-31 32-63 0 1
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.