0% found this document useful (0 votes)
58 views

15.082 and 6.855J: Dijkstra's Algorithm

The document describes an example of running Dijkstra's algorithm on a graph to find the shortest path between nodes. It shows the steps of initializing distances, selecting the node with the minimum distance, updating distances and predecessors of neighboring nodes, and repeating until all nodes are made permanent. In the end, the shortest path from node 1 to 6 can be found by tracing back the predecessors.

Uploaded by

Lipi Sharma
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

15.082 and 6.855J: Dijkstra's Algorithm

The document describes an example of running Dijkstra's algorithm on a graph to find the shortest path between nodes. It shows the steps of initializing distances, selecting the node with the minimum distance, updating distances and predecessors of neighboring nodes, and repeating until all nodes are made permanent. In the end, the shortest path from node 1 to 6 can be found by tracing back the predecessors.

Uploaded by

Lipi Sharma
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

15.082 and 6.

855J

Dijkstras Algorithm

An Example

2 4

4 2 3 2

0
1

2 1 4 3 3 5 2

Initialize Select the node with the minimum temporary distance label.

Update Step
2
2 4

4 2 3 2

0
1

2 1 4 3 3 5 2

Choose Minimum Temporary Label


2
2 4

4 2 3 2

0
1

2 1 4 3 3 5 2

Update Step
2
2 4

6
4 2 3 2

0
1

2 1 4 3 3 5 2

4 3 The predecessor of node 3 is now node 2

Choose Minimum Temporary Label


2
2 4

6
4 2 3 2

0
1

2 1 4 3 3 5 2

Update
2
2 4

6
4 2 3 2

0
1

2 1 4 3 3 5 2

d(5) is not changed.

Choose Minimum Temporary Label


2
2 4

6
4 2 3 2

0
1

2 1 4 3 3 5 2

Update
2
2 4

6
4 2 3 2

0
1

2 1 4 3 3 5 2

d(4) is not changed

Choose Minimum Temporary Label


2
2 4

6
4 2 3 2

0
1

2 1 4 3 3 5 2

10

Update
2
2 4

6
4 2 3 2

0
1

2 1 4 3 3 5 2

d(6) is not updated

11

Choose Minimum Temporary Label


2
2 4

6
4 2 3 2

0
1

2 1 4 3 3 5 2

There is nothing to update


12

End of Algorithm
2
2 4

6
4 2 3 2

0
1

2 1 4 3 3 5 2

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

13

You might also like