1 / 13

Understanding Dijkstra's Algorithm: A Step-by-Step Example

This guide explains Dijkstra's Algorithm through a detailed example. Dijkstra's method is used for finding the shortest paths from a starting node to all other nodes in a weighted graph. The process involves initializing nodes, selecting the node with the minimum temporary distance, and updating distances and predecessors. We walk through each step, demonstrating how nodes are selected based on their distance labels and how the predecessor relationships are established. By the end, you'll grasp how to trace the shortest path from the starting node to any other.

Télécharger la présentation

Understanding Dijkstra's Algorithm: A Step-by-Step Example

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 15.082 and 6.855J Dijkstra’s Algorithm

  2. 1 An Example   4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5   Initialize Select the node with the minimum temporary distance label.

  3. Update Step 2   4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5   4

  4. Choose Minimum Temporary Label 2  4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5  4

  5. Update Step 6 2  4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5  4 4 3 The predecessor of node 3 is now node 2

  6. Choose Minimum Temporary Label 2 6 4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5 3 4

  7. Update 2 6 4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5 3 4 d(5) is not changed.

  8. Choose Minimum Temporary Label 2 6 4 2 4 2 2 0 2 1 3  1 6 4 2 3 3 5 3 4

  9. Update 2 6 4 2 4 2 2 0 6 2 1 3  1 6 4 2 3 3 5 3 4 d(4) is not changed

  10. 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

  11. Update 2 6 4 2 4 2 2 0 2 1 3 6 1 6 4 2 3 3 5 3 4 d(6) is not updated

  12. 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 There is nothing to update

  13. 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

More Related