180 likes | 296 Views
Explore Dijkstra's algorithm with simple buckets, also known as Dial's algorithm, through step-by-step visualizations. Learn how to initialize distance labels, update them, choose minimum temporary labels, and find the shortest path. End the algorithm with all nodes permanent and form a predecessor tree for the shortest path. Source: MITOpenCourseWare.
E N D
15.082J & 6.855J & ESD.78JVisualizations Dijkstra’s Algorithm with simple buckets (also known as Dial’s algorithm)
∞ ∞ 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
0 1 2 3 4 5 6 7 Update Step 2 ∞ ∞ 4 2 4 2 2 0 2 1 3 ∞ 1 6 4 2 3 3 5 ∞ ∞ ∞ 4 2 3 4 5 1 6
0 1 2 3 4 5 6 7 Choose Minimum Temporary Label Find Min by starting at the leftmost bucket and scanning right till there is a non-empty bucket. 2 ∞ 4 2 4 2 2 0 2 1 3 ∞ 1 6 4 2 3 3 5 ∞ ∞ 4 4 5 6 2 3
0 1 2 3 4 5 6 7 Update Step 6 2 ∞ 4 2 4 2 2 0 2 1 3 ∞ 1 6 4 2 3 3 5 ∞ ∞ 4 4 3 4 5 6 2 3
0 1 2 3 4 5 6 7 Choose Minimum Temporary Label Find Min by starting at the leftmost bucket and scanning right till there is a non-empty bucket. 2 6 4 2 4 2 2 0 2 1 3 ∞ 1 6 4 2 3 3 5 ∞ 3 4 6 3 5 4
0 1 2 3 4 5 6 7 Update 2 6 4 2 4 2 2 0 2 1 3 ∞ 1 6 4 2 3 3 5 ∞ 3 4 6 3 5 4
∞ 0 1 2 3 4 5 6 7 Choose Minimum Temporary Label 2 6 4 2 4 2 2 0 2 1 3 ∞ 1 6 4 2 3 3 5 3 4 6 5 4
0 1 2 3 4 5 6 7 Update 2 6 4 2 4 2 2 0 6 2 1 3 ∞ 1 6 4 2 3 3 5 ∞ 3 4 6 5 4
0 1 2 3 4 5 6 7 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 4 6
0 1 2 3 4 5 6 7 Update 2 6 4 2 4 2 2 0 2 1 3 6 1 6 4 2 3 3 5 3 4 4 6
0 1 2 3 4 5 6 7 Choose Minimum Temporary Label 2 6 4 2 4 There is nothing to update 2 2 0 2 1 3 6 1 6 4 2 3 3 5 3 4 6
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
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.