Shortest Path from G to C Using Dijkstra’s Algorithm
This presentation is the property of its rightful owner.
Sponsored Links
1 / 19

Shortest Path from G to C Using Dijkstra’s Algorithm PowerPoint PPT Presentation


  • 110 Views
  • Uploaded on
  • Presentation posted in: General

Shortest Path from G to C Using Dijkstra’s Algorithm. Hamid Behravan. 2. B. C. 1. 3. 2. 6. 3. 4. 4. D. E. F. A. 1. 5. 2. 5. G. H. 5. Unsolved Node. Solved Node. We will be finding the shortest path from origin, G, to the destination, C, using Dijkstra’s Algorithm.

Download Presentation

Shortest Path from G to C Using Dijkstra’s Algorithm

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.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 from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

HamidBehravan

2

B

C

1

3

2

6

3

4

4

D

E

F

A

1

5

2

5

G

H

5

Unsolved Node

Solved Node

We will be finding the shortest path from origin, G, to the destination, C, using Dijkstra’s Algorithm.


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

2

B

C

1

3

2

6

3

4

4

D

E

F

A

1

5

2

5

G

H

5

Unsolved Node

Solved Node

Initialize by displaying the origin as solved node. We labeled it as 0, since it has 0 units from the origin.


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

2

B

C

1

3

2

6

3

4

4

D

E

F

A

1

5

2

5

G

H

5

0

Unsolved Node

Solved Node

Initialize by displaying the origin as solved node. We labeled it as 0, since it has 0 units from the origin.


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

2

B

C

1

3

2

6

3

4

4

D

E

F

A

1

5

2

5

G

H

5

0

Unsolved Node

Solved Node

Identify all unsolved node connected to any solved node.


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

2

B

C

1

3

2

6

3

4

4

D

E

F

A

1

5

2

5

G

H

5

0

Unsolved Node

Solved Node

Identify all unsolved node connected to any solved node.


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

2

B

C

1

3

2

6

3

4

4

D

E

F

A

1

5

2

5

G

H

5

0

Unsolved Node

Solved Node

For each node connecting a solved and unsolved nodes, calculate the candidate distance.

Candidate Distance = Distance to the solved node + Length of arc


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

2

B

C

1

3

2

6

3

5

4

4

D

E

F

A

2

2

5

0+5

1

5

0+2

5

G

H

0+5

0

5

Unsolved Node

Solved Node

For each node connecting a solved and unsolved nodes, calculate the candidate distance.

Candidate Distance = Distance to the solved node + Length of arc


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

2

B

C

1

3

2

6

3

5

4

4

D

E

F

A

2

2

5

0+5

1

5

0+2

5

G

H

0+5

0

5

Unsolved Node

Solved Node

Choose the smallest Node Distance


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

2

B

C

1

3

2

6

3

5

4

4

D

E

F

A

2

2

5

1

5

5

G

H

0

Unsolved Node

Solved Node

Change Node A to solved and labeled it with the candidate distance.


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

2

B

C

1

3

2

6

3

4

4

D

E

F

A

2

5

1

5

2

G

H

0

5

Unsolved Node

Solved Node

Add the arc to arc set

Repeat all these steps until we get to destination node


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

3

2

B

C

1+2=3

3

1

2

6

5

5

3+2=5

4

4

D

E

F

A

2

3

5

0+5=5

1

5

2

5

G

H

0+5=5

0

5

Unsolved Node

Solved Node

Calculate the candidate distance of each connecting arc.


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

3

2

B

C

1+2=3

3

1

2

6

4

4

D

E

F

A

2

3

5

1

5

2

5

G

H

0

Unsolved Node

Solved Node

Choose the smallest Node Distance


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

3

2

B

C

3

1

2

6

4

4

D

E

F

A

2

3

5

1

5

2

5

G

H

0

5

Unsolved Node

Solved Node

Change Node B to solved and labeled it with the candidate distance. Add the arc to the arc set.


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

3

2

B

C

3

1

2

6

4

4

D

E

F

A

2

3

5

1

5

2

5

G

H

0

5

Unsolved Node

Solved Node

We have not reached our destination node, so we will continue.


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

3

2

B

C

3

1

2

6

4

4

D

E

F

A

2

3

5

1

5

2

5

G

H

0

5

Unsolved Node

Solved Node

Identify all unsolved node connected to any solved node. Calculate the candidate distance of each connecting arc.


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

3

5

3+2=5

B

C

2

3

1

2

6

3+2=5

0+5=5

5

4

4

D

E

F

A

2

3

5

1

5

0+5=5

2

5

G

H

5

0+5=5

0

5

Unsolved Node

Solved Node

Identify all unsolved node connected to any solved node. Calculate the candidate distance of each connecting arc.


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

3

5

3+2=5

B

C

2

3

1

2

6

3+2=5

0+5=5

5

4

4

D

E

F

A

2

3

5

1

5

0+5=5

2

5

G

H

5

0+5=5

0

5

Unsolved Node

Solved Node

We have a tie for the smallest candidate distance. If we choose C, then we get to our destination.


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

3

5

2

B

C

3

1

2

6

4

4

D

E

F

A

2

3

5

1

5

2

5

G

H

0

Unsolved Node

Solved Node

The Shortest Root to C is:


Shortest path from g to c using dijkstra s algorithm

Shortest Path from G to C Using Dijkstra’s Algorithm

3

5

2

B

C

3

1

2

6

4

4

D

E

F

A

2

3

5

1

5

2

5

G

H

0

Unsolved Node

Solved Node

The Shortest Root to C is:

G – A – B - C


  • Login