03_4 - Shortest Path Problems - Dial's Algorithm - An Example.pdf ...

0 downloads 169 Views 60KB Size Report
There was a problem previewing this document. Retrying... Download ... 03_4 - Shortest Path Problems - Dial's Algorithm
An Example Initialize distance labels



∞ 4

2 2

0

Initialize buckets.

4 2

2

1

1

3

6

4

2

1

1

2

3

3

3

Select the node with the minimum temporary distance label. 0



5

∞ 4



∞ 5

6

7

2 3 4 5 6 2

Update Step 2 ∞

∞ 4

2

4

2

0

2 2

1

1

3

6

4

2 3

3

5

∞ 4 0 1

1

2 2

3



4 3



∞ 5

6

7

2 3 4 5 6 3

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

0

2 2

1

1

3

4

1

3

3

2 2

3



2 5

4 3





4 0

6

5

6

7

4 5 6

4

Update Step 6 ∞

2 4

2

4

2

0

2 2

1

1

3

6

4

2 3

3

0

1

2

3

2

3



4 3 4 3 5

5



∞ 4 5

6 4

7

4 5 6

5

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

0

2 2

1

1

3

4

1

3

3

2



2 5

3 0

6

3

4

3

5



4 5

6 4

7 6

6

Update 2

6 4

2

4

2

0

2 2

1

1

3

6

4

2 3

3

5

3 0

1

2



3

4

3

5



4 5

6 4

7 6

7

Choose Minimum Temporary Label 2

6 4

2

4

2

0

2 2

1

1

3

6

4

2 3

3

5

3 0

1

2

3



4 5



4 5

6 4

7 6

8

Update 2

6 4

2

4

2

0

2 2

1

1

3

6

4

2 3

3

5

3 0

1

2

3

6 ∞

4 5



4 5

6 4 6

7 6

9

Choose Minimum Temporary Label 2

6 4

2

4

2

0

2 2

1

1

3

6

4

2 3

3

5

3 0

1

2

3

6

4

4 5

6

7

4 6 10

Update 2

6 4

2

4

2

0

2 2

1

1

3

6

4

2 3

3

5

3 0

1

2

3

6

4

4 5

6

7

4 6 11

Choose Minimum Temporary Label 2

6 4

2

There is nothing to update

4

2

0

2 2

1

1

3

6

4

2 3

3

5

3 0

1

2

3

6

4

4 5

6

7

6 12

End of Algorithm 2 2

0

6 4

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

13