SlideShare una empresa de Scribd logo
1 de 30
SCHOOL MANAGEMENT SYSTEM
Submited BY:
Faisal Patel 254
Parth Bharuch 257
Dhavan Shah 160
Introduction
 Our project is about
Introduction Contd.
 Greedy algorithms use problem solving methods based on actions to see if there’s
a better long term strategy.
 Dijkstra’s algorithm uses the greedy approach to solve the single source shortest
problem. It repeatedly selects from the unselected vertices, vertex v nearest to
source s and declares the distance to be the actual shortest distance from s to v.
 The edges of v are then checked to see if their destination can be reached by v
followed by the relevant outgoing edges.
 For a given source node in the graph, the algorithm finds the shortest path
between that node and every other.
 It can also be used for finding the shortest paths from a single node to a single
destination node by stopping the algorithm once the shortest path to the
destination node has been determined.
How It Works??
 Before going into details of the pseudo-code of the algorithm it is important
to know how the algorithm works.
 Dijkstra’s algorithm works by solving the sub-problem k, which computes the
shortest path from the source to vertices among the k closest vertices to the
source.
 For the dijkstra’s algorithm to work it should be directed- weighted graph and
the edges should be non-negative.
 If the edges are negative then the actual shortest path cannot be obtained.
More Detailed Knowledge
 At the kth round, there will be a set called Frontier of k vertices that will
consist of the vertices closest to the source and the vertices that lie outside
frontier are computed and put into New Frontier.
 The shortest distance obtained is maintained in sDist[w].
 It holds the estimate of the distance from s to w.
 Dijkstra’s algorithm finds the next closest vertex by maintaining the New
Frontier vertices in a priority-min queue.
6
Dijkstra's Shortest Path Algorithm
 Find shortest path from s to t.
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6
7
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6







0
distance label
S = { }
PQ = { s, 2, 3, 4, 5, 6, 7, t }
8
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6







0
distance label
S = { }
PQ = { s, 2, 3, 4, 5, 6, 7, t }
delmin
9
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9



14

0
distance label
S = { s }
PQ = { 2, 3, 4, 5, 6, 7, t }
decrease key
X

X
X
10
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9



14

0
distance label
S = { s }
PQ = { 2, 3, 4, 5, 6, 7, t }
X

X
X
delmin
11
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9



14

0
S = { s, 2 }
PQ = { 3, 4, 5, 6, 7, t }
X

X
X
12
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9



14

0
S = { s, 2 }
PQ = { 3, 4, 5, 6, 7, t }
X

X
X
decrease key
X 33
13
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9



14

0
S = { s, 2 }
PQ = { 3, 4, 5, 6, 7, t }
X

X
X
X 33
delmin
14
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9



14

0
S = { s, 2, 6 }
PQ = { 3, 4, 5, 7, t }
X

X
X
X 33
44
X
X
32
15
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9


14

0
S = { s, 2, 6 }
PQ = { 3, 4, 5, 7, t }
X

X
X
44
X
delmin
X 33X
32
16
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9


14

0
S = { s, 2, 6, 7 }
PQ = { 3, 4, 5, t }
X

X
X
44
X
35X
59 X
24
X 33X
32
17
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9


14

0
S = { s, 2, 6, 7 }
PQ = { 3, 4, 5, t }
X

X
X
44
X
35X
59 X
delmin
X 33X
32
18
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9


14

0
S = { s, 2, 3, 6, 7 }
PQ = { 4, 5, t }
X

X
X
44
X
35X
59 XX51
X 34
X 33X
32
19
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9


14

0
S = { s, 2, 3, 6, 7 }
PQ = { 4, 5, t }
X

X
X
44
X
35X
59 XX51
X 34
delmin
X 33X
32
24
20
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9


14

0
S = { s, 2, 3, 5, 6, 7 }
PQ = { 4, t }
X

X
X
44
X
35X
59 XX51
X 34
24
X50
X45
X 33X
32
21
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9


14

0
S = { s, 2, 3, 5, 6, 7 }
PQ = { 4, t }
X

X
X
44
X
35X
59 XX51
X 34
24
X50
X45
delmin
X 33X
32
22
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9


14

0
S = { s, 2, 3, 4, 5, 6, 7 }
PQ = { t }
X

X
X
44
X
35X
59 XX51
X 34
24
X50
X45
X 33X
32
23
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9


14

0
S = { s, 2, 3, 4, 5, 6, 7 }
PQ = { t }
X

X
X
44
X
35X
59 XX51
X 34
X50
X45
delmin
X 33X
32
24
24
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9


14

0
S = { s, 2, 3, 4, 5, 6, 7, t }
PQ = { }
X

X
X
44
X
35X
59 XX51
X 34
X50
X45
X 33X
32
25
Dijkstra's Shortest Path Algorithm
s
3
t
2
6
7
4
5
24
18
2
9
14
15
5
30
20
44
16
11
6
19
6
15
9


14

0
S = { s, 2, 3, 4, 5, 6, 7, t }
PQ = { }
X

X
X
44
X
35X
59 XX51
X 34
X50
X45
X 33X
32
ALgorithm
function Dijkstra(Graph, source):
dist[source] ← 0 // Distance from source to source
prev[source] ← undefined // Previous node in optimal path initialization
for each vertex v in Graph: // Initialization
if v ≠ source // Where v has not yet been removed from Q (unvisited nodes)
dist[v] ← infinity // Unknown distance function from source to v
prev[v] ← undefined // Previous node in optimal path from source
end if
add v to Q // All nodes initially in Q (unvisited nodes)
end for
while Q is not empty:
u ← vertex in Q with min dist[u] // Source node in first case
remove u from Q
for each neighbor v of u: // where v is still in Q.
alt ← dist[u] + length(u, v)
if alt < dist[v]: // A shorter path to v has been found
dist[v] ← alt
prev[v] ← u
end if
end for
end while
return dist[], prev[]
end function
EFFICIENCY
 The complexity efficiency can be expressed in terms of Big-O Notation.
Big-O gives another way of talking about the way input affects the
algorithm’s running time. It gives an upper bound of the running time.
 In Dijkstra’s algorithm, the efficiency varies depending on |V| and |E|
updates for priority queues that were used.
 If a Fibonacci heap was used then the complexity is O( | E | + | V | log |
V | ) , which is the best bound.
DIS-ADVANTAGES
 The major disadvantage of the algorithm is the fact that it does a blind
search there by consuming a lot of time waste of necessary resources.
 Another disadvantage is that it cannot handle negative edges. This leads to
acyclic graphs and most often cannot obtain the right shortest path
APPLICATIONS
 Traffic information systems use Dijkstra’s algorithm in order to track the
source and destinations from a given particular source and destination .
 OSPF- Open Shortest Path First, used in Internet routing.
 It uses a link-state in the individual areas that make up the hierarchy.
 The computation is based on Dijkstra's algorithm which is used to calculate
the shortest path tree inside each area of the network.

Más contenido relacionado

La actualidad más candente

Networks dijkstra's algorithm- pgsr
Networks  dijkstra's algorithm- pgsrNetworks  dijkstra's algorithm- pgsr
Networks dijkstra's algorithm- pgsr
Linawati Adiman
 
Bellman ford Algorithm
Bellman ford AlgorithmBellman ford Algorithm
Bellman ford Algorithm
taimurkhan803
 

La actualidad más candente (20)

Prim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning treePrim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning tree
 
The Floyd–Warshall algorithm
The Floyd–Warshall algorithmThe Floyd–Warshall algorithm
The Floyd–Warshall algorithm
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Shortest path algorithm
Shortest path algorithmShortest path algorithm
Shortest path algorithm
 
Dijkstra's Algorithm
Dijkstra's Algorithm Dijkstra's Algorithm
Dijkstra's Algorithm
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
 
Dijkstra
DijkstraDijkstra
Dijkstra
 
Dijkstra algorithm a dynammic programming approach
Dijkstra algorithm   a dynammic programming approachDijkstra algorithm   a dynammic programming approach
Dijkstra algorithm a dynammic programming approach
 
Networks dijkstra's algorithm- pgsr
Networks  dijkstra's algorithm- pgsrNetworks  dijkstra's algorithm- pgsr
Networks dijkstra's algorithm- pgsr
 
Prims and kruskal algorithms
Prims and kruskal algorithmsPrims and kruskal algorithms
Prims and kruskal algorithms
 
Shortest path algorithms
Shortest path algorithmsShortest path algorithms
Shortest path algorithms
 
Graph theory presentation
Graph theory presentationGraph theory presentation
Graph theory presentation
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithm
 
Bellman ford Algorithm
Bellman ford AlgorithmBellman ford Algorithm
Bellman ford Algorithm
 
PRIM’S AND KRUSKAL’S ALGORITHM
PRIM’S AND KRUSKAL’S  ALGORITHMPRIM’S AND KRUSKAL’S  ALGORITHM
PRIM’S AND KRUSKAL’S ALGORITHM
 
Bellman ford algorithm
Bellman ford algorithmBellman ford algorithm
Bellman ford algorithm
 
dijkstra algo.ppt
dijkstra algo.pptdijkstra algo.ppt
dijkstra algo.ppt
 
Floyd warshall-algorithm
Floyd warshall-algorithmFloyd warshall-algorithm
Floyd warshall-algorithm
 
Graph theory
Graph theory Graph theory
Graph theory
 
PRIM'S ALGORITHM
PRIM'S ALGORITHMPRIM'S ALGORITHM
PRIM'S ALGORITHM
 

Destacado

Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
guest862df4e
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
Srikrishnan Suresh
 
Dijkstra algorithm
Dijkstra algorithmDijkstra algorithm
Dijkstra algorithm
are you
 
Review And Evaluations Of Shortest Path Algorithms
Review And Evaluations Of Shortest Path AlgorithmsReview And Evaluations Of Shortest Path Algorithms
Review And Evaluations Of Shortest Path Algorithms
Pawan Kumar Tiwari
 
EXTERNAL - Whitepaper - How 3 Cyber ThreatsTransform Incident Response 081516
EXTERNAL - Whitepaper - How 3 Cyber ThreatsTransform Incident Response 081516EXTERNAL - Whitepaper - How 3 Cyber ThreatsTransform Incident Response 081516
EXTERNAL - Whitepaper - How 3 Cyber ThreatsTransform Incident Response 081516
Yasser Mohammed
 
Lewis Dijkstra, DG Regional Policy
Lewis Dijkstra, DG Regional PolicyLewis Dijkstra, DG Regional Policy
Lewis Dijkstra, DG Regional Policy
plan4all
 

Destacado (20)

Shortest Path Problem: Algoritma Dijkstra
Shortest Path Problem: Algoritma DijkstraShortest Path Problem: Algoritma Dijkstra
Shortest Path Problem: Algoritma Dijkstra
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
 
Dijkstra & flooding ppt(Routing algorithm)
Dijkstra & flooding ppt(Routing algorithm)Dijkstra & flooding ppt(Routing algorithm)
Dijkstra & flooding ppt(Routing algorithm)
 
Shortest path problem
Shortest path problemShortest path problem
Shortest path problem
 
Application of Dijkstra Algorithm in Robot path planning
Application of Dijkstra Algorithm in Robot path planningApplication of Dijkstra Algorithm in Robot path planning
Application of Dijkstra Algorithm in Robot path planning
 
Dijkstra's Algorithm - Colleen Young
Dijkstra's Algorithm  - Colleen YoungDijkstra's Algorithm  - Colleen Young
Dijkstra's Algorithm - Colleen Young
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
Dijkstra algorithm
Dijkstra algorithmDijkstra algorithm
Dijkstra algorithm
 
Distance vector routing
Distance vector routingDistance vector routing
Distance vector routing
 
Dijkastra’s algorithm
Dijkastra’s algorithmDijkastra’s algorithm
Dijkastra’s algorithm
 
Kruskal & Prim's Algorithm
Kruskal & Prim's AlgorithmKruskal & Prim's Algorithm
Kruskal & Prim's Algorithm
 
Bellman Ford's Algorithm
Bellman Ford's AlgorithmBellman Ford's Algorithm
Bellman Ford's Algorithm
 
Kruskal Algorithm
Kruskal AlgorithmKruskal Algorithm
Kruskal Algorithm
 
Review And Evaluations Of Shortest Path Algorithms
Review And Evaluations Of Shortest Path AlgorithmsReview And Evaluations Of Shortest Path Algorithms
Review And Evaluations Of Shortest Path Algorithms
 
Walking ...
Walking ...Walking ...
Walking ...
 
EXTERNAL - Whitepaper - How 3 Cyber ThreatsTransform Incident Response 081516
EXTERNAL - Whitepaper - How 3 Cyber ThreatsTransform Incident Response 081516EXTERNAL - Whitepaper - How 3 Cyber ThreatsTransform Incident Response 081516
EXTERNAL - Whitepaper - How 3 Cyber ThreatsTransform Incident Response 081516
 
The future internet web 3.0
The future internet  web 3.0The future internet  web 3.0
The future internet web 3.0
 
Lewis Dijkstra, DG Regional Policy
Lewis Dijkstra, DG Regional PolicyLewis Dijkstra, DG Regional Policy
Lewis Dijkstra, DG Regional Policy
 
Comparative Analysis of Algorithms for Single Source Shortest Path Problem
Comparative Analysis of Algorithms for Single Source Shortest Path ProblemComparative Analysis of Algorithms for Single Source Shortest Path Problem
Comparative Analysis of Algorithms for Single Source Shortest Path Problem
 
Intelligent water drops (Persian)
Intelligent water drops (Persian)Intelligent water drops (Persian)
Intelligent water drops (Persian)
 

Similar a Dijkstra’s algorithm

01-05-2023, SOL_DU_MBAFT_6202_Dijkstra’s Algorithm Dated 1st May 23.pdf
01-05-2023, SOL_DU_MBAFT_6202_Dijkstra’s Algorithm Dated 1st May 23.pdf01-05-2023, SOL_DU_MBAFT_6202_Dijkstra’s Algorithm Dated 1st May 23.pdf
01-05-2023, SOL_DU_MBAFT_6202_Dijkstra’s Algorithm Dated 1st May 23.pdf
DKTaxation
 
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
KUSHDHIRRA2111026030
 
Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithm
meisamstar
 
Single source Shortest path algorithm with example
Single source Shortest path algorithm with exampleSingle source Shortest path algorithm with example
Single source Shortest path algorithm with example
VINITACHAUHAN21
 
CPSC125 ch6 sec3
CPSC125 ch6 sec3CPSC125 ch6 sec3
CPSC125 ch6 sec3
David Wood
 

Similar a Dijkstra’s algorithm (20)

Bellman-Ford-Moore Algorithm and Dijkstra’s Algorithm
Bellman-Ford-Moore Algorithm and Dijkstra’s AlgorithmBellman-Ford-Moore Algorithm and Dijkstra’s Algorithm
Bellman-Ford-Moore Algorithm and Dijkstra’s Algorithm
 
Jaimin chp-5 - network layer- 2011 batch
Jaimin   chp-5 - network layer- 2011 batchJaimin   chp-5 - network layer- 2011 batch
Jaimin chp-5 - network layer- 2011 batch
 
2.3 shortest path dijkstra’s
2.3 shortest path dijkstra’s 2.3 shortest path dijkstra’s
2.3 shortest path dijkstra’s
 
01-05-2023, SOL_DU_MBAFT_6202_Dijkstra’s Algorithm Dated 1st May 23.pdf
01-05-2023, SOL_DU_MBAFT_6202_Dijkstra’s Algorithm Dated 1st May 23.pdf01-05-2023, SOL_DU_MBAFT_6202_Dijkstra’s Algorithm Dated 1st May 23.pdf
01-05-2023, SOL_DU_MBAFT_6202_Dijkstra’s Algorithm Dated 1st May 23.pdf
 
dijkstras example.ppt
dijkstras example.pptdijkstras example.ppt
dijkstras example.ppt
 
04 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x204 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x2
 
Algo labpresentation a_group
Algo labpresentation a_groupAlgo labpresentation a_group
Algo labpresentation a_group
 
12_Graph.pptx
12_Graph.pptx12_Graph.pptx
12_Graph.pptx
 
04 greedyalgorithmsii
04 greedyalgorithmsii04 greedyalgorithmsii
04 greedyalgorithmsii
 
(148065320) dijistra algo
(148065320) dijistra algo(148065320) dijistra algo
(148065320) dijistra algo
 
dijkstraC.ppt
dijkstraC.pptdijkstraC.ppt
dijkstraC.ppt
 
barrera.ppt
barrera.pptbarrera.ppt
barrera.ppt
 
barrera.ppt
barrera.pptbarrera.ppt
barrera.ppt
 
Shortest Path Problem.docx
Shortest Path Problem.docxShortest Path Problem.docx
Shortest Path Problem.docx
 
Single sourceshortestpath by emad
Single sourceshortestpath by emadSingle sourceshortestpath by emad
Single sourceshortestpath by emad
 
DAA_Presentation - Copy.pptx
DAA_Presentation - Copy.pptxDAA_Presentation - Copy.pptx
DAA_Presentation - Copy.pptx
 
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
 
Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithm
 
Single source Shortest path algorithm with example
Single source Shortest path algorithm with exampleSingle source Shortest path algorithm with example
Single source Shortest path algorithm with example
 
CPSC125 ch6 sec3
CPSC125 ch6 sec3CPSC125 ch6 sec3
CPSC125 ch6 sec3
 

Dijkstra’s algorithm

  • 1. SCHOOL MANAGEMENT SYSTEM Submited BY: Faisal Patel 254 Parth Bharuch 257 Dhavan Shah 160
  • 3. Introduction Contd.  Greedy algorithms use problem solving methods based on actions to see if there’s a better long term strategy.  Dijkstra’s algorithm uses the greedy approach to solve the single source shortest problem. It repeatedly selects from the unselected vertices, vertex v nearest to source s and declares the distance to be the actual shortest distance from s to v.  The edges of v are then checked to see if their destination can be reached by v followed by the relevant outgoing edges.  For a given source node in the graph, the algorithm finds the shortest path between that node and every other.  It can also be used for finding the shortest paths from a single node to a single destination node by stopping the algorithm once the shortest path to the destination node has been determined.
  • 4. How It Works??  Before going into details of the pseudo-code of the algorithm it is important to know how the algorithm works.  Dijkstra’s algorithm works by solving the sub-problem k, which computes the shortest path from the source to vertices among the k closest vertices to the source.  For the dijkstra’s algorithm to work it should be directed- weighted graph and the edges should be non-negative.  If the edges are negative then the actual shortest path cannot be obtained.
  • 5. More Detailed Knowledge  At the kth round, there will be a set called Frontier of k vertices that will consist of the vertices closest to the source and the vertices that lie outside frontier are computed and put into New Frontier.  The shortest distance obtained is maintained in sDist[w].  It holds the estimate of the distance from s to w.  Dijkstra’s algorithm finds the next closest vertex by maintaining the New Frontier vertices in a priority-min queue.
  • 6. 6 Dijkstra's Shortest Path Algorithm  Find shortest path from s to t. s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6
  • 7. 7 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6        0 distance label S = { } PQ = { s, 2, 3, 4, 5, 6, 7, t }
  • 8. 8 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6        0 distance label S = { } PQ = { s, 2, 3, 4, 5, 6, 7, t } delmin
  • 9. 9 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9    14  0 distance label S = { s } PQ = { 2, 3, 4, 5, 6, 7, t } decrease key X  X X
  • 10. 10 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9    14  0 distance label S = { s } PQ = { 2, 3, 4, 5, 6, 7, t } X  X X delmin
  • 11. 11 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9    14  0 S = { s, 2 } PQ = { 3, 4, 5, 6, 7, t } X  X X
  • 12. 12 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9    14  0 S = { s, 2 } PQ = { 3, 4, 5, 6, 7, t } X  X X decrease key X 33
  • 13. 13 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9    14  0 S = { s, 2 } PQ = { 3, 4, 5, 6, 7, t } X  X X X 33 delmin
  • 14. 14 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9    14  0 S = { s, 2, 6 } PQ = { 3, 4, 5, 7, t } X  X X X 33 44 X X 32
  • 15. 15 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9   14  0 S = { s, 2, 6 } PQ = { 3, 4, 5, 7, t } X  X X 44 X delmin X 33X 32
  • 16. 16 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9   14  0 S = { s, 2, 6, 7 } PQ = { 3, 4, 5, t } X  X X 44 X 35X 59 X 24 X 33X 32
  • 17. 17 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9   14  0 S = { s, 2, 6, 7 } PQ = { 3, 4, 5, t } X  X X 44 X 35X 59 X delmin X 33X 32
  • 18. 18 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9   14  0 S = { s, 2, 3, 6, 7 } PQ = { 4, 5, t } X  X X 44 X 35X 59 XX51 X 34 X 33X 32
  • 19. 19 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9   14  0 S = { s, 2, 3, 6, 7 } PQ = { 4, 5, t } X  X X 44 X 35X 59 XX51 X 34 delmin X 33X 32 24
  • 20. 20 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9   14  0 S = { s, 2, 3, 5, 6, 7 } PQ = { 4, t } X  X X 44 X 35X 59 XX51 X 34 24 X50 X45 X 33X 32
  • 21. 21 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9   14  0 S = { s, 2, 3, 5, 6, 7 } PQ = { 4, t } X  X X 44 X 35X 59 XX51 X 34 24 X50 X45 delmin X 33X 32
  • 22. 22 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9   14  0 S = { s, 2, 3, 4, 5, 6, 7 } PQ = { t } X  X X 44 X 35X 59 XX51 X 34 24 X50 X45 X 33X 32
  • 23. 23 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9   14  0 S = { s, 2, 3, 4, 5, 6, 7 } PQ = { t } X  X X 44 X 35X 59 XX51 X 34 X50 X45 delmin X 33X 32 24
  • 24. 24 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9   14  0 S = { s, 2, 3, 4, 5, 6, 7, t } PQ = { } X  X X 44 X 35X 59 XX51 X 34 X50 X45 X 33X 32
  • 25. 25 Dijkstra's Shortest Path Algorithm s 3 t 2 6 7 4 5 24 18 2 9 14 15 5 30 20 44 16 11 6 19 6 15 9   14  0 S = { s, 2, 3, 4, 5, 6, 7, t } PQ = { } X  X X 44 X 35X 59 XX51 X 34 X50 X45 X 33X 32
  • 26. ALgorithm function Dijkstra(Graph, source): dist[source] ← 0 // Distance from source to source prev[source] ← undefined // Previous node in optimal path initialization for each vertex v in Graph: // Initialization if v ≠ source // Where v has not yet been removed from Q (unvisited nodes) dist[v] ← infinity // Unknown distance function from source to v prev[v] ← undefined // Previous node in optimal path from source end if add v to Q // All nodes initially in Q (unvisited nodes) end for
  • 27. while Q is not empty: u ← vertex in Q with min dist[u] // Source node in first case remove u from Q for each neighbor v of u: // where v is still in Q. alt ← dist[u] + length(u, v) if alt < dist[v]: // A shorter path to v has been found dist[v] ← alt prev[v] ← u end if end for end while return dist[], prev[] end function
  • 28. EFFICIENCY  The complexity efficiency can be expressed in terms of Big-O Notation. Big-O gives another way of talking about the way input affects the algorithm’s running time. It gives an upper bound of the running time.  In Dijkstra’s algorithm, the efficiency varies depending on |V| and |E| updates for priority queues that were used.  If a Fibonacci heap was used then the complexity is O( | E | + | V | log | V | ) , which is the best bound.
  • 29. DIS-ADVANTAGES  The major disadvantage of the algorithm is the fact that it does a blind search there by consuming a lot of time waste of necessary resources.  Another disadvantage is that it cannot handle negative edges. This leads to acyclic graphs and most often cannot obtain the right shortest path
  • 30. APPLICATIONS  Traffic information systems use Dijkstra’s algorithm in order to track the source and destinations from a given particular source and destination .  OSPF- Open Shortest Path First, used in Internet routing.  It uses a link-state in the individual areas that make up the hierarchy.  The computation is based on Dijkstra's algorithm which is used to calculate the shortest path tree inside each area of the network.