Shortest Path Algorithm

1 / 7

# Shortest Path Algorithm - PowerPoint PPT Presentation

Shortest Path Algorithm. This is called â€œDijkstraâ€™s Algorithmâ€. â€¦pronounced â€œDirk-straâ€. Problem:. Find the shortest route from A to F. Step 1 Label the start vertex S with a permanent label of 0.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'Shortest Path Algorithm' - yon

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Shortest Path Algorithm

This is called “Dijkstra’s Algorithm”

…pronounced “Dirk-stra”

Problem:

Find the shortest route from A to F

Step 2 Put a temporary label on each vertex that can be reached directly from the vertex that has just received a permanent label. The temporary label must be equal to the sum of the permanent label and the weight of the arc linking it directly to the vertex. If there is already a temporary label at the vertex, it is only replaced if the new sum is smaller.

Step 4 Repeat steps 2 and 3 until the destination vertex T receives its permanent label.

Step 5 Trace back from T to S including an arc AB whenever the permanent label of B  permanent label of A = the weight of AB, given that B already lies on the path.

Problem:

Find the shortest route from A to F

On the exam paper your diagram will look like this:

but 15 > 13 so ignore

15

B

3

7

D

5

13

8

7

13

16 – 13 = 3 so use DF

Now trace back from F

Third vertex is B

Fifth vertex is D

Sixth vertex is F

Second vertex is C

Fourth vertex is E

First vertex is A

3

13 – 9 = 4 so use CD

7

Label 13

Label 12

Label 7

Label 0

Label 16

Label 4

4 – 0 = 4 so use AC

A

1

0

F

6

16

17

16

5

9

Shortest Path is ACDF of length 16

4

Temporary Labels

5

C

2

4

E

4

12

9

4

13

12