Implementation of Dijkstras Algorithm Dijkstras Algorithm Implementations With
- Slides: 21
Implementation of Dijkstra’s Algorithm
Dijkstra’s Algorithm
Implementations • With min-priority queue, Dijkstra algorithm can be implemented in time • With Fibonacci heap, Dijkstra algorithm can be implemented in time • With Radix heap, Dijkstra algorithm can be implemented in time
An Example 2 0 4 4 2 2 1 1 2 3 6 4 2 3 Initialize Select the node with the minimum temporary distance label. 3 5 1 0 2 ∞ 4 5 ∞ 3 ∞ ∞ 6 ∞
Update Step 2 2 0 4 4 2 2 1 1 2 3 6 4 2 3 3 5 1 0 2 ∞ 4 5 ∞ 3 ∞ ∞ 6 ∞
Update Step 2 2 0 4 4 2 2 1 1 2 3 6 4 2 3 3 5 1 0 2 2 Decrease-Key(S, 2, 2) 4 5 ∞ 3 ∞ ∞ 6 ∞
Update Step 2 2 0 4 4 2 2 1 1 2 3 6 4 2 3 4 Decrease-Key(S, 2, 2) Decrease-Key(S, 3, 4) 3 5 1 0 2 2 4 5 ∞ 3 4 ∞ 6 ∞
Update Step 2 2 0 4 4 2 2 1 1 2 3 6 4 2 3 4 3 5 6 ∞ 2 2 Extract-Min(S) 4 5 ∞ 3 4 ∞
Choose Minimum Temporary Label 2 2 0 4 4 2 2 1 1 2 3 6 4 2 3 4 3 5 2 2 6 ∞ 4 5 ∞ 3 4 ∞
Update Step 2 2 0 4 The predecessor of node 3 is now node 2 6 4 2 2 1 1 2 3 6 4 2 3 4 3 Decrease-Key(S, 3, 3) Decrease-Key(S, 4, 6) Decrease-Key(S, 5, 4) 3 5 4 2 2 5 4 6 ∞ 4 3 3 6
Choose Minimum Temporary Label 2 2 0 4 6 4 2 2 1 1 2 3 6 4 2 3 3 3 5 4 4 6 5 4 Extract-Min(S) 6 ∞ 3 3
Choose Minimum Temporary Label 2 2 0 4 6 4 2 2 1 1 2 3 6 4 2 3 3 3 5 4 Extract-Min(S) 6 ∞ 4 6
Update 2 2 0 4 6 4 2 2 1 1 2 3 6 4 2 3 3 3 5 4 d(5) is not changed. 6 ∞ 4 6
Choose Minimum Temporary Label 2 2 0 4 6 4 2 2 1 1 2 3 4 6 2 3 3 Extract-Min(S) 3 5 4 6 ∞ 5 4 4 6
Choose Minimum Temporary Label 2 2 0 4 6 4 2 2 1 1 2 3 4 6 2 3 3 Extract-Min(S) 3 5 4 6 ∞ 4 6
Update 2 2 0 4 6 4 2 2 1 1 d(4) is not changed 2 3 4 6 6 2 3 3 3 5 4 6 Decrease-Key(S, 6, 6) 6 4 6
Choose Minimum Temporary Label 2 2 0 4 6 4 2 2 1 1 2 3 4 6 6 2 3 3 3 5 4 4 6 6 6
Update 2 2 0 4 6 4 2 2 1 1 2 3 4 6 6 2 3 3 3 5 4 4 6 6 d(6) is not updated 6
Choose Minimum Temporary Label 2 2 0 4 6 4 2 2 1 1 2 3 4 6 6 2 3 3 3 5 4 There is nothing to update 6 6
End of Algorithm 2 2 0 4 6 4 2 2 1 1 2 3 4 6 6 2 3 3 3 5 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
Implementations • Decrease-Key(S, x, key): Call at most m times. • Extract-Min(S): Call n times. • With min-priority queue, Dijkstra algorithm can be implemented in time
- Common standard ethernet implementations
- Ethics in security management
- Smalltalk
- Ricart-agrawala algorithm
- 33 por 4
- Ao* algorithm
- Adrie wessels
- Coordinating marketing activities
- Big bang vs phased implementation approach pros and cons
- Iep development and implementation
- Lg erp implementation
- Mis issues in strategy implementation
- Siebel to salesforce implementation
- Phong shading vs gouraud shading
- Office 365 implementation plan
- Edi vendor onboarding
- Staffing follows strategy
- Contract implementation
- Nasa evm implementation handbook
- Ppm selection project
- Storage implementation services
- How to make implementation plan