SlideShare a Scribd company logo
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.

More Related Content

What's hot (20)

PPTX
Dijkstra's algorithm presentation
Subid Biswas
 
PPTX
Networks dijkstra's algorithm- pgsr
Linawati Adiman
 
PDF
Shortest path algorithms
Amit Kumar Rathi
 
PPT
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Mohanlal Sukhadia University (MLSU)
 
PPT
SINGLE-SOURCE SHORTEST PATHS
Md. Shafiuzzaman Hira
 
PPTX
implementation of travelling salesman problem with complexity ppt
AntaraBhattacharya12
 
PDF
Shortest Path in Graph
Dr Sandeep Kumar Poonia
 
PPTX
Dijkstra's Algorithm
Rashik Ishrak Nahian
 
PPTX
Dijkstra
jagdeeparora86
 
PPTX
Dijkstra algorithm a dynammic programming approach
Akash Sethiya
 
PPTX
Shortest path problem
Ifra Ilyas
 
PPTX
Bellman ford Algorithm
taimurkhan803
 
PPTX
Prims and kruskal algorithms
Saga Valsalan
 
PDF
Minimum spanning tree
Amit Kumar Rathi
 
PPTX
All pair shortest path
Arafat Hossan
 
PPTX
Shortest path algorithm
sana younas
 
PPT
Graph coloring problem
V.V.Vanniaperumal College for Women
 
PPTX
The n Queen Problem
Sukrit Gupta
 
PDF
All pairs shortest path algorithm
Srikrishnan Suresh
 
PDF
I.BEST FIRST SEARCH IN AI
vikas dhakane
 
Dijkstra's algorithm presentation
Subid Biswas
 
Networks dijkstra's algorithm- pgsr
Linawati Adiman
 
Shortest path algorithms
Amit Kumar Rathi
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Mohanlal Sukhadia University (MLSU)
 
SINGLE-SOURCE SHORTEST PATHS
Md. Shafiuzzaman Hira
 
implementation of travelling salesman problem with complexity ppt
AntaraBhattacharya12
 
Shortest Path in Graph
Dr Sandeep Kumar Poonia
 
Dijkstra's Algorithm
Rashik Ishrak Nahian
 
Dijkstra
jagdeeparora86
 
Dijkstra algorithm a dynammic programming approach
Akash Sethiya
 
Shortest path problem
Ifra Ilyas
 
Bellman ford Algorithm
taimurkhan803
 
Prims and kruskal algorithms
Saga Valsalan
 
Minimum spanning tree
Amit Kumar Rathi
 
All pair shortest path
Arafat Hossan
 
Shortest path algorithm
sana younas
 
Graph coloring problem
V.V.Vanniaperumal College for Women
 
The n Queen Problem
Sukrit Gupta
 
All pairs shortest path algorithm
Srikrishnan Suresh
 
I.BEST FIRST SEARCH IN AI
vikas dhakane
 

Viewers also liked (16)

PDF
Shortest Path Problem: Algoritma Dijkstra
Onggo Wiryawan
 
PDF
Dijkstra's Algorithm
guest862df4e
 
PPTX
Application of Dijkstra Algorithm in Robot path planning
Darling Jemima
 
PPTX
Dijkstra's Algorithm - Colleen Young
Colleen Young
 
DOCX
Dijkstra algorithm
are you
 
PPT
Distance vector routing
Siddique Ibrahim
 
PPTX
Dijkastra’s algorithm
Pulkit Goel
 
PPT
Bellman Ford's Algorithm
Tanmay Baranwal
 
PPTX
Kruskal Algorithm
Snehasis Panigrahi
 
PPTX
Review And Evaluations Of Shortest Path Algorithms
Pawan Kumar Tiwari
 
PPT
Walking ...
vlastos
 
PDF
EXTERNAL - Whitepaper - How 3 Cyber ThreatsTransform Incident Response 081516
Yasser Mohammed
 
PPTX
The future internet web 3.0
Lippo Group Digital
 
PPT
Lewis Dijkstra, DG Regional Policy
plan4all
 
PDF
Comparative Analysis of Algorithms for Single Source Shortest Path Problem
CSCJournals
 
PDF
Intelligent water drops (Persian)
mortezaT
 
Shortest Path Problem: Algoritma Dijkstra
Onggo Wiryawan
 
Dijkstra's Algorithm
guest862df4e
 
Application of Dijkstra Algorithm in Robot path planning
Darling Jemima
 
Dijkstra's Algorithm - Colleen Young
Colleen Young
 
Dijkstra algorithm
are you
 
Distance vector routing
Siddique Ibrahim
 
Dijkastra’s algorithm
Pulkit Goel
 
Bellman Ford's Algorithm
Tanmay Baranwal
 
Kruskal Algorithm
Snehasis Panigrahi
 
Review And Evaluations Of Shortest Path Algorithms
Pawan Kumar Tiwari
 
Walking ...
vlastos
 
EXTERNAL - Whitepaper - How 3 Cyber ThreatsTransform Incident Response 081516
Yasser Mohammed
 
The future internet web 3.0
Lippo Group Digital
 
Lewis Dijkstra, DG Regional Policy
plan4all
 
Comparative Analysis of Algorithms for Single Source Shortest Path Problem
CSCJournals
 
Intelligent water drops (Persian)
mortezaT
 
Ad

Similar to Dijkstra’s algorithm (20)

PPT
2.3 shortest path dijkstra’s
Krish_ver2
 
PPT
dijkstras example.ppt
Gayathrik635081
 
PPTX
SEMINAR ON SHORTEST PATH ALGORITHMS.pptx
bharatherltech
 
PPTX
dms slide discrete mathematics sem 2 engineering
pranavstar99
 
PDF
Bellman-Ford-Moore Algorithm and Dijkstra’s Algorithm
Fulvio Corno
 
PPTX
Dijkstra Algorithm Presentation -the shortest path finding algorithm.pptx
GhazalaAnjum9
 
DOCX
Shortest Path Problem.docx
SeethaDinesh
 
PDF
04 greedyalgorithmsii 2x2
MuradAmn
 
PDF
Djikstra’s Algorithm. Approach to shortest path algorithm with greedy method
khushigdgjdcoem
 
PDF
Dijkstra Shortest Path Visualization
IRJET Journal
 
PPTX
Deixtras Algorithm.pptxdjjdjdjdjddddddddddddddd
OrxanMirzzad
 
PPT
barrera.ppt
gopikahari7
 
PPT
barrera.ppt
MahinoorMahi1
 
PPT
Dijkstra's algorithm for computer science
ajmalnajath4
 
PPT
Jaimin chp-5 - network layer- 2011 batch
Jaimin Jani
 
PPTX
Single source Shortest path algorithm with example
VINITACHAUHAN21
 
PPTX
Algo labpresentation a_group
Umme habiba
 
PPTX
Data structures and algorithms Dijkstra’s Algorithm (1).pptx
deeps805023
 
PPTX
Dijkstras-Algorithm-Finding-the-Shortest-Path.pptx
GhazalaAnjum9
 
PPT
Dijkstra algorithm ds 57612334t4t44.ppt
ssuser7b9bda1
 
2.3 shortest path dijkstra’s
Krish_ver2
 
dijkstras example.ppt
Gayathrik635081
 
SEMINAR ON SHORTEST PATH ALGORITHMS.pptx
bharatherltech
 
dms slide discrete mathematics sem 2 engineering
pranavstar99
 
Bellman-Ford-Moore Algorithm and Dijkstra’s Algorithm
Fulvio Corno
 
Dijkstra Algorithm Presentation -the shortest path finding algorithm.pptx
GhazalaAnjum9
 
Shortest Path Problem.docx
SeethaDinesh
 
04 greedyalgorithmsii 2x2
MuradAmn
 
Djikstra’s Algorithm. Approach to shortest path algorithm with greedy method
khushigdgjdcoem
 
Dijkstra Shortest Path Visualization
IRJET Journal
 
Deixtras Algorithm.pptxdjjdjdjdjddddddddddddddd
OrxanMirzzad
 
barrera.ppt
gopikahari7
 
barrera.ppt
MahinoorMahi1
 
Dijkstra's algorithm for computer science
ajmalnajath4
 
Jaimin chp-5 - network layer- 2011 batch
Jaimin Jani
 
Single source Shortest path algorithm with example
VINITACHAUHAN21
 
Algo labpresentation a_group
Umme habiba
 
Data structures and algorithms Dijkstra’s Algorithm (1).pptx
deeps805023
 
Dijkstras-Algorithm-Finding-the-Shortest-Path.pptx
GhazalaAnjum9
 
Dijkstra algorithm ds 57612334t4t44.ppt
ssuser7b9bda1
 
Ad

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.