Dijkstra - PowerPoint PPT Presentation

Loading...

PPT – Dijkstra PowerPoint presentation | free to download - id: 6fa8e7-MGQzZ



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Dijkstra

Description:

Dijkstra s Algorithm Priority Queue: Dequeued Paths: Start: C Find: E Use Dijkstra s algorithm to find the shortest path from C to E in terms of optimal cost. – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 41
Provided by: Daniel1020
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Dijkstra


1
Dijkstras Algorithm
Priority Queue Dequeued Paths
Start C Find E Use Dijkstras algorithm to find the shortest path from C to E in terms of optimal cost. Show your queue and dequeued paths to the right.
2
Dijkstras Algorithm
Priority Queue 0 - C Dequeued Paths
Start C Find E Step Enqueue start node with cost 0.
3
Dijkstras Algorithm
Priority Queue 0 - C Dequeued Paths 0 - C
Start C Find E Step Dequeue min path.
4
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C Dequeued Paths 0 - C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
5
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C Dequeued Paths 0 - C 2 - F,C
Start C Find E Step Dequeue min path.
6
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C Dequeued Paths 0 - C 2 - F,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
7
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C
Start C Find E Step Dequeue min path.
8
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
9
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C
Start C Find E Step Dequeue min path.
10
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
11
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C
Start C Find E Step Dequeue min path.
12
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
13
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C
Start C Find E Step Dequeue min path.
14
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path
15
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C
Start C Find E Step Dequeue min path.
16
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path
17
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C
Start C Find E Step Dequeue min path.
18
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
19
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C
Start C Find E Step Dequeue min path.
20
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C
12 - F,J,A,C 9 - G,J,A,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
21
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C
12 - F,J,A,C 9 - G,J,A,C
Start C Find E Step Dequeue min path.
22
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
23
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C
Start C Find E Step Dequeue min path.
24
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
25
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C
Start C Find E Step Dequeue min path.
26
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path
27
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C
Start C Find E Step Dequeue min path.
28
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C 14 - D,G,J,A,C 13 - E,D,J,A,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
29
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C 10 - G,F,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C 14 - D,G,J,A,C 13 - E,D,J,A,C
Start C Find E Step Dequeue min path.
30
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C 10 - G,F,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C 14 - D,G,J,A,C 13 - E,D,J,A,C 16 -
D,G,F,C 12 - E,G,F,C 12 - J,G,F,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
31
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C 10 - G,F,C 10 - J,F,A,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C 14 - D,G,J,A,C 13 - E,D,J,A,C 16 -
D,G,F,C 12 - E,G,F,C 12 - J,G,F,C
Start C Find E Step Dequeue min path.
32
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C 10 - G,F,C 10 - J,F,A,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C 14 - D,G,J,A,C 13 - E,D,J,A,C 16 -
D,G,F,C 12 - E,G,F,C 12 - J,G,F,C 16 -
B,J,F,A,C 12 - G,J,F,A,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
33
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C 10 - G,F,C 10 - J,F,A,C 10 - A,J,F,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C 14 - D,G,J,A,C 13 - E,D,J,A,C 16 -
D,G,F,C 12 - E,G,F,C 12 - J,G,F,C 16 -
B,J,F,A,C 12 - G,J,F,A,C
Start C Find E Step Dequeue min path.
34
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C 10 - G,F,C 10 - J,F,A,C 10 - A,J,F,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C 14 - D,G,J,A,C 13 - E,D,J,A,C 16 -
D,G,F,C 12 - E,G,F,C 12 - J,G,F,C 16 -
B,J,F,A,C 12 - G,J,F,A,C 14 - B,A,J,F,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
35
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C 10 - G,F,C 10 - J,F,A,C 10 - A,J,F,C 12 - B,J,A,F,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C 14 - D,G,J,A,C 13 - E,D,J,A,C 16 -
D,G,F,C 12 - E,G,F,C 12 - J,G,F,C 16 -
B,J,F,A,C 12 - G,J,F,A,C 14 - B,A,J,F,C
Start C Find E Step Dequeue min path.
36
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C 10 - G,F,C 10 - J,F,A,C 10 - A,J,F,C 12 - B,J,A,F,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C 14 - D,G,J,A,C 13 - E,D,J,A,C 16 -
D,G,F,C 12 - E,G,F,C 12 - J,G,F,C 16 -
B,J,F,A,C 12 - G,J,F,A,C 14 - B,A,J,F,C
Start C Find E Step No place to go on this path.
37
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C 10 - G,F,C 10 - J,F,A,C 10 - A,J,F,C 12 - B,J,A,F,C 12 - F,J,A,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C 14 - D,G,J,A,C 13 - E,D,J,A,C 16 -
D,G,F,C 12 - E,G,F,C 12 - J,G,F,C 16 -
B,J,F,A,C 12 - G,J,F,A,C 14 - B,A,J,F,C
Start C Find E Step Dequeue min path.
38
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C 10 - G,F,C 10 - J,F,A,C 10 - A,J,F,C 12 - B,J,A,F,C 12 - F,J,A,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C 14 - D,G,J,A,C 13 - E,D,J,A,C 16 -
D,G,F,C 12 - E,G,F,C 12 - J,G,F,C 16 -
B,J,F,A,C 12 - G,J,F,A,C 14 - B,A,J,F,C 20 -
G,F,J,A,C
Start C Find E Step Enqueue paths to all adjacent nodes not already on your path.
39
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C 10 - G,F,C 10 - J,F,A,C 10 - A,J,F,C 12 - B,J,A,F,C 12 - F,J,A,C 12 - E,G,J,A,F,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C 14 - D,G,J,A,C 13 - E,D,J,A,C 16 -
D,G,F,C 12 - E,G,F,C 12 - J,G,F,C 16 -
B,J,F,A,C 12 - G,J,F,A,C 14 - B,A,J,F,C 20 -
G,F,J,A,C
Start C Find E Step Dequeue min path.
40
Dijkstras Algorithm
Priority Queue 0 - C 4 - A,C 2 - F,C 3 - A,F,C 10 - G,F,C 7 - J,F,C 7 - B,A,F,C 6 - J,A,F,C 8 - B,A,C 5 - F,A,C 7 - J,A,C 13 - G,F,A,C 10 - J,F,A,C 12 - B,J,A,F,C 8 - G,J,A,F,C 10 - A,J,F,C 13 - B,J,F,C 9 - G,J,F,C 13 - J,B,A,F,C 13 - B,J,A,C Dequeued Paths 0 - C 2 - F,C 3 - A,F,C 4 - A,C 5 - F,A,C 6 - J,A,F,C 7 - J,F,C 7 - B,A,F,C 7 - J,A,C 8 - B,A,C 8 - G,J,A,F,C 9 - G,J,F,C 9 - G,J,A,C 10 - G,F,C 10 - J,F,A,C 10 - A,J,F,C 12 - B,J,A,F,C 12 - F,J,A,C 12 - E,G,J,A,F,C
12 - F,J,A,C 9 - G,J,A,C 14 - J,B,A,C 13 -
D,G,J,A,F,C 12 - E,G,J,A,F,C 14 - D,G,J,F,C 13 -
E,D,J,F,C 14 - D,G,J,A,C 13 - E,D,J,A,C 16 -
D,G,F,C 12 - E,G,F,C 12 - J,G,F,C 16 -
B,J,F,A,C 12 - G,J,F,A,C 14 - B,A,J,F,C 20 -
G,F,J,A,C
Start C Find E Step And we have finally dequeued the target node Answer C, F, A, J, G, E.
About PowerShow.com