Download presentation
Presentation is loading. Please wait.
Published byMichelle Carney Modified over 10 years ago
1
15.082 and 6.855J Dijkstras Algorithm with simple buckets (also known as Dials algorithm)
2
2 An Example 1 2 3 4 5 6 2 4 2 1 3 4 2 3 2 Initialize distance labels 1 0 Select the node with the minimum temporary distance label. 01234567 1 2 3 4 5 6 Initialize buckets.
3
3 Update Step 2 3 4 5 6 2 4 2 1 3 4 2 3 2 2 4 0 1 01234567 1 2 3 4 5 6 23
4
4 Choose Minimum Temporary Label 1 3 4 5 6 2 4 2 1 3 4 2 3 2 2 4 0 2 01234567 4 5 6 23 Find Min by starting at the leftmost bucket and scanning right till there is a non-empty bucket.
5
5 Update Step 1 2 3 4 5 6 2 4 2 1 3 4 2 3 2 2 4 6 4 3 0 01234567 4 5 6 23 3 4 5
6
6 Choose Minimum Temporary Label 1 24 5 6 2 4 2 1 3 4 2 3 2 2 3 6 4 0 3 01234567 6 3 45 Find Min by starting at the leftmost bucket and scanning right till there is a non-empty bucket.
7
7 Update 1 24 5 6 2 4 2 1 3 4 2 3 2 0 3 2 3 6 4 01234567 6 3 45
8
8 Choose Minimum Temporary Label 1 24 6 2 4 2 1 3 4 2 3 2 0 3 2 3 6 4 5 01234567 6 45
9
9 Update 1 24 6 2 4 2 1 3 4 2 3 2 0 3 2 3 6 4 5 6 01234567 6 45 6
10
10 Choose Minimum Temporary Label 1 2 6 2 4 2 1 3 4 2 3 2 0 3 2 3 6 4 5 6 4 01234567 4 6
11
11 Update 1 2 6 2 4 2 1 3 4 2 3 2 0 3 2 3 6 4 5 6 4 01234567 4 6
12
12 Choose Minimum Temporary Label 1 2 2 4 2 1 3 4 2 3 2 0 3 2 3 6 4 5 6 4 6 01234567 6 There is nothing to update
13
13 End of Algorithm 1 2 2 4 2 1 3 4 2 3 2 0 3 2 3 6 4 5 6 4 6 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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.