15.082J & 6.855J & ESD.78J Visualizations Dijkstra’s Algorithm

advertisement

15.082J & 6.855J & ESD.78J

Visualizations

Dijkstra’s Algorithm

An Example

2

4

2

0

1

4

3

Initialize

Select the node with the minimum temporary distance label.

3

2

4

3

2

2

5

6

2

An Example

2

4

2

0

1

4

3

Initialize

Select the node with the minimum temporary distance label.

3

2

4

3

2

2

5

6

3

0

1

4

2

Update Step

2

2

4

4

1 2 3

3

3

4

5

2

2

6

4

Choose Minimum Temporary Label

0

1

2

4

4

3

2

2

1

4

3

2

4

3

2

2

5

6

5

0

1

4

2

Update Step

2

2

4

6

4

1 2 3

3

4

3

3 5

4

2

2

The predecessor of node 3 is now node 2

6

6

Choose Minimum Temporary Label

0

1

2

4

3

3

2

2

1

4

3

2

5

4

6

4

3

2

2

6

7

Update

0

1

2

4

3

3

2

2

1

4

3

2

5

4

6

4

3

2

2

6

∞ d(5) is not changed.

8

Choose Minimum Temporary Label

0

1

2

4

3

3

2

2

1

4

3

2

5

4

6

4

3

2

2

6

9

Update

0

1

2

4

3

3

2

2

1

4

3

2

5

4

6

4

3

2

2

6

6

∞ d(4) is not changed

10

Choose Minimum Temporary Label

0

1

2

4

3

3

2

2

1

4

3

2

5

4

6

4

3

2

2

6 6

11

Update

0

1

2

4

3

3

2

2

1

4

3

2

5

4

6

4

3

2

2

6 6 d(6) is not updated

12

Choose Minimum Temporary Label

0

1

2

4

3

3

2

2

1

4

3

2

5

4

6

4

3

2

2

6 6

There is nothing to update

13

End of Algorithm

0

1

2

4

3

3

2

2

1

4

3

2

5

4

6

4

3

2

2

6 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

14

MIT OpenCourseWare 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 .

Download