SlideShare a Scribd company logo
1 of 14
Download to read offline
DIJKSTRA’S ALGORITHM
Represented by Group: 3
• Arijit Dhali
• Ipsita Raha
Department : Electronic & Communication Engineering
Year : 2nd
Session : 2021-22
Data Structure and Algorithm
ES – CSS 301
TABLE OF CONTENTS
01
Understanding
Dijkstra
02
Algorithm and
Pseudocode
03
Decoding
04
Complexity
What is Dijkstra’s Algorithm ?
Dijkstra's algorithm is an algorithm that
allows us to find the shortest path between
any two vertices of a graph.
DIJKSTRA’S
ALGORITHM
Dijkstra's Algorithm works on the basis that any subpath B -> D of the
shortest path A -> D between vertices A and D is also the shortest path
between vertices B and D.
Dijkstra used this property in the opposite direction i.e we
overestimate the distance of each vertex from the starting vertex. Then
we visit each node and its neighbors to find the shortest subpath to
those neighbors.
The algorithm uses a greedy approach in the sense that we find the
next best solution hoping that the end result is the best solution for
the whole problem.
HOW DIJKSTRA’S ALGORITHM
WORK?
UNDERSTANDING DIJKSTRA
We need to maintain the path distance of every vertex. We can store that in an array of
size v, where v is the number of vertices.
We also want to be able to get the shortest path, not only know the length of the shortest path.
For this, we map each vertex to the vertex that last updated its path length.
Once the algorithm is over, we can backtrack from the destination vertex to the source vertex to
find the path.
A minimum priority queue can be used to efficiently receive the vertex with least path distance.
PSEUDOCODE OF DIJKSTRA
1 function Dijkstra(Graph, source):
2
3 create vertex set Q
4
5 for each vertex v in Graph:
6 dist[v] ← INFINITY
7 prev[v] ← UNDEFINED
8 add v to Q
9 dist[source] ← 0
10
11 while Q is not empty:
12 u ← vertex in Q with min dist[u]
13
14 remove u from Q
15
16 for each neighbor v of u still in Q:
17 alt ← dist[u] + length(u, v)
18 if alt < dist[v]:
19 dist[v] ← alt
20 prev[v] ← u
21
22 return dist[], prev[]
PSEUDOCODE
CODE FOR DIJKSTRA’S ALGORITHM
The implementation of Dijkstra's Algorithm in C
is given. The complexity of the code can be
improved, but the abstractions are convenient to
relate the code with the algorithm.
Scan this
QR Code using Google Lens to get access to the
drive containing necessary coding files
Log in using College ID
Time Complexity: O(E Log V)
where, E is the number of edges and V is the number of vertices.
Space Complexity: O(V)
DIJKSTRA’S ALGORITHM COMPLEXITY
APPLICATIONS OF DIJKSTRA’S
ALGORITHM
• To find the shortest path
• In social networking applications
• In a telephone network
• To find the locations in the map
CONCLUSION
When the algorithm finishes, each vertex reachable from the
source has v. distance set to the length of the shortest path
from the source, and v. parent set to its parent in the tree of
shortest paths.
• https://www.programiz.com/dsa/dijkstra-algorithm
• https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
• https://www.quora.com/What-is-the-conclusion-of-Dijkstras-algorithm
BIBLIOGRAPHY
For your precious time towards our
presentation
THANK
YOU!

More Related Content

What's hot (20)

Dijkstra's algorithm
Dijkstra's algorithmDijkstra's algorithm
Dijkstra's algorithm
 
dijkstra algo.ppt
dijkstra algo.pptdijkstra algo.ppt
dijkstra algo.ppt
 
Shortest Path in Graph
Shortest Path in GraphShortest Path in Graph
Shortest Path in Graph
 
Shortest path algorithm
Shortest  path algorithmShortest  path algorithm
Shortest path algorithm
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
 
Single source stortest path bellman ford and dijkstra
Single source stortest path bellman ford and dijkstraSingle source stortest path bellman ford and dijkstra
Single source stortest path bellman ford and dijkstra
 
Dijkstra
DijkstraDijkstra
Dijkstra
 
Shortest path algorithm
Shortest path algorithmShortest path algorithm
Shortest path algorithm
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Networks dijkstra's algorithm- pgsr
Networks  dijkstra's algorithm- pgsrNetworks  dijkstra's algorithm- pgsr
Networks dijkstra's algorithm- pgsr
 
Prim's algorithm
Prim's algorithmPrim's algorithm
Prim's algorithm
 
Floyd Warshall Algorithm
Floyd Warshall AlgorithmFloyd Warshall Algorithm
Floyd Warshall Algorithm
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
PRIM'S ALGORITHM
PRIM'S ALGORITHMPRIM'S ALGORITHM
PRIM'S ALGORITHM
 
Bellman ford algorithm
Bellman ford algorithmBellman ford algorithm
Bellman ford algorithm
 
Bellman ford Algorithm
Bellman ford AlgorithmBellman ford Algorithm
Bellman ford Algorithm
 
Bellman Ford's Algorithm
Bellman Ford's AlgorithmBellman Ford's Algorithm
Bellman Ford's Algorithm
 
Spanning trees
Spanning treesSpanning trees
Spanning trees
 
Graph traversals in Data Structures
Graph traversals in Data StructuresGraph traversals in Data Structures
Graph traversals in Data Structures
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
 

Similar to Dijkstra's Algorithm Explained

All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithmSrikrishnan Suresh
 
Algo labpresentation a_group
Algo labpresentation a_groupAlgo labpresentation a_group
Algo labpresentation a_groupUmme habiba
 
Flight-schedule using Dijkstra's algorithm with comparison of routes findings
Flight-schedule using Dijkstra's algorithm with comparison of  routes findingsFlight-schedule using Dijkstra's algorithm with comparison of  routes findings
Flight-schedule using Dijkstra's algorithm with comparison of routes findingsIJECEIAES
 
Dijkstra Searching Algorithms Shortest.pptx
Dijkstra Searching Algorithms Shortest.pptxDijkstra Searching Algorithms Shortest.pptx
Dijkstra Searching Algorithms Shortest.pptxsandeep54552
 
Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithmmeisamstar
 
Implementation of dijsktra’s algorithm in parallel
Implementation of dijsktra’s algorithm in parallelImplementation of dijsktra’s algorithm in parallel
Implementation of dijsktra’s algorithm in parallelMeenakshi Muthuraman
 
Ram minimum spanning tree
Ram   minimum spanning treeRam   minimum spanning tree
Ram minimum spanning treeRama Prasath A
 
2.6 all pairsshortestpath
2.6 all pairsshortestpath2.6 all pairsshortestpath
2.6 all pairsshortestpathKrish_ver2
 
Dijkstra Shortest Path Visualization
Dijkstra Shortest Path VisualizationDijkstra Shortest Path Visualization
Dijkstra Shortest Path VisualizationIRJET Journal
 
Randomized algorithms all pairs shortest path
Randomized algorithms  all pairs shortest pathRandomized algorithms  all pairs shortest path
Randomized algorithms all pairs shortest pathMohammad Akbarizadeh
 
Spanning Tree in data structure and .pptx
Spanning Tree in data structure and .pptxSpanning Tree in data structure and .pptx
Spanning Tree in data structure and .pptxasimshahzad8611
 
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...KUSHDHIRRA2111026030
 

Similar to Dijkstra's Algorithm Explained (20)

All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
barrera.ppt
barrera.pptbarrera.ppt
barrera.ppt
 
barrera.ppt
barrera.pptbarrera.ppt
barrera.ppt
 
12_Graph.pptx
12_Graph.pptx12_Graph.pptx
12_Graph.pptx
 
Algo labpresentation a_group
Algo labpresentation a_groupAlgo labpresentation a_group
Algo labpresentation a_group
 
04 greedyalgorithmsii
04 greedyalgorithmsii04 greedyalgorithmsii
04 greedyalgorithmsii
 
Flight-schedule using Dijkstra's algorithm with comparison of routes findings
Flight-schedule using Dijkstra's algorithm with comparison of  routes findingsFlight-schedule using Dijkstra's algorithm with comparison of  routes findings
Flight-schedule using Dijkstra's algorithm with comparison of routes findings
 
Dijkstra.ppt
Dijkstra.pptDijkstra.ppt
Dijkstra.ppt
 
Dijkstra Searching Algorithms Shortest.pptx
Dijkstra Searching Algorithms Shortest.pptxDijkstra Searching Algorithms Shortest.pptx
Dijkstra Searching Algorithms Shortest.pptx
 
Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithm
 
Implementation of dijsktra’s algorithm in parallel
Implementation of dijsktra’s algorithm in parallelImplementation of dijsktra’s algorithm in parallel
Implementation of dijsktra’s algorithm in parallel
 
Ram minimum spanning tree
Ram   minimum spanning treeRam   minimum spanning tree
Ram minimum spanning tree
 
distance_matrix_ch
distance_matrix_chdistance_matrix_ch
distance_matrix_ch
 
Cnetwork
CnetworkCnetwork
Cnetwork
 
(148065320) dijistra algo
(148065320) dijistra algo(148065320) dijistra algo
(148065320) dijistra algo
 
2.6 all pairsshortestpath
2.6 all pairsshortestpath2.6 all pairsshortestpath
2.6 all pairsshortestpath
 
Dijkstra Shortest Path Visualization
Dijkstra Shortest Path VisualizationDijkstra Shortest Path Visualization
Dijkstra Shortest Path Visualization
 
Randomized algorithms all pairs shortest path
Randomized algorithms  all pairs shortest pathRandomized algorithms  all pairs shortest path
Randomized algorithms all pairs shortest path
 
Spanning Tree in data structure and .pptx
Spanning Tree in data structure and .pptxSpanning Tree in data structure and .pptx
Spanning Tree in data structure and .pptx
 
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
 

More from ArijitDhali

Signal Constellation, Geometric Interpretation of Signals
Signal Constellation,  Geometric Interpretation of  SignalsSignal Constellation,  Geometric Interpretation of  Signals
Signal Constellation, Geometric Interpretation of SignalsArijitDhali
 
Stack Queue SubRoutine
Stack Queue SubRoutineStack Queue SubRoutine
Stack Queue SubRoutineArijitDhali
 
Overviewing the techniques of Numerical Integration.pdf
Overviewing the techniques of Numerical Integration.pdfOverviewing the techniques of Numerical Integration.pdf
Overviewing the techniques of Numerical Integration.pdfArijitDhali
 
Motorola 68020.pdf
Motorola 68020.pdfMotorola 68020.pdf
Motorola 68020.pdfArijitDhali
 
Stereotactic Radiosurgery in Brain Metastases.pdf
Stereotactic Radiosurgery in Brain Metastases.pdfStereotactic Radiosurgery in Brain Metastases.pdf
Stereotactic Radiosurgery in Brain Metastases.pdfArijitDhali
 
Active Filters.pdf
Active Filters.pdfActive Filters.pdf
Active Filters.pdfArijitDhali
 
Wideband Frequency Modulation.pdf
Wideband Frequency Modulation.pdfWideband Frequency Modulation.pdf
Wideband Frequency Modulation.pdfArijitDhali
 
Celebrity Problem.pdf
Celebrity Problem.pdfCelebrity Problem.pdf
Celebrity Problem.pdfArijitDhali
 
SSBSC Single Side Band - Suppressed Carrier Compressed
SSBSC Single Side Band - Suppressed Carrier CompressedSSBSC Single Side Band - Suppressed Carrier Compressed
SSBSC Single Side Band - Suppressed Carrier CompressedArijitDhali
 
Biodiversity Hotspots in India
Biodiversity Hotspots in IndiaBiodiversity Hotspots in India
Biodiversity Hotspots in IndiaArijitDhali
 
LTI Systems - With/Without Memory
LTI Systems - With/Without MemoryLTI Systems - With/Without Memory
LTI Systems - With/Without MemoryArijitDhali
 
RLC Series Resonance
RLC Series ResonanceRLC Series Resonance
RLC Series ResonanceArijitDhali
 
Bivariate Discrete Distribution
Bivariate Discrete DistributionBivariate Discrete Distribution
Bivariate Discrete DistributionArijitDhali
 
Conditional Probability
Conditional ProbabilityConditional Probability
Conditional ProbabilityArijitDhali
 
Isomerism of Transition Metal Complex
Isomerism of Transition Metal ComplexIsomerism of Transition Metal Complex
Isomerism of Transition Metal ComplexArijitDhali
 
Space Solar Power
Space Solar PowerSpace Solar Power
Space Solar PowerArijitDhali
 
Types of function call
Types of function callTypes of function call
Types of function callArijitDhali
 
Power Series - Legendre Polynomial - Bessel's Equation
Power Series - Legendre Polynomial - Bessel's EquationPower Series - Legendre Polynomial - Bessel's Equation
Power Series - Legendre Polynomial - Bessel's EquationArijitDhali
 

More from ArijitDhali (20)

Signal Constellation, Geometric Interpretation of Signals
Signal Constellation,  Geometric Interpretation of  SignalsSignal Constellation,  Geometric Interpretation of  Signals
Signal Constellation, Geometric Interpretation of Signals
 
Stack Queue SubRoutine
Stack Queue SubRoutineStack Queue SubRoutine
Stack Queue SubRoutine
 
Overviewing the techniques of Numerical Integration.pdf
Overviewing the techniques of Numerical Integration.pdfOverviewing the techniques of Numerical Integration.pdf
Overviewing the techniques of Numerical Integration.pdf
 
Motorola 68020.pdf
Motorola 68020.pdfMotorola 68020.pdf
Motorola 68020.pdf
 
Stereotactic Radiosurgery in Brain Metastases.pdf
Stereotactic Radiosurgery in Brain Metastases.pdfStereotactic Radiosurgery in Brain Metastases.pdf
Stereotactic Radiosurgery in Brain Metastases.pdf
 
Active Filters.pdf
Active Filters.pdfActive Filters.pdf
Active Filters.pdf
 
Wideband Frequency Modulation.pdf
Wideband Frequency Modulation.pdfWideband Frequency Modulation.pdf
Wideband Frequency Modulation.pdf
 
Celebrity Problem.pdf
Celebrity Problem.pdfCelebrity Problem.pdf
Celebrity Problem.pdf
 
SSBSC Single Side Band - Suppressed Carrier Compressed
SSBSC Single Side Band - Suppressed Carrier CompressedSSBSC Single Side Band - Suppressed Carrier Compressed
SSBSC Single Side Band - Suppressed Carrier Compressed
 
Biodiversity Hotspots in India
Biodiversity Hotspots in IndiaBiodiversity Hotspots in India
Biodiversity Hotspots in India
 
LTI Systems - With/Without Memory
LTI Systems - With/Without MemoryLTI Systems - With/Without Memory
LTI Systems - With/Without Memory
 
RLC Series Resonance
RLC Series ResonanceRLC Series Resonance
RLC Series Resonance
 
Bivariate Discrete Distribution
Bivariate Discrete DistributionBivariate Discrete Distribution
Bivariate Discrete Distribution
 
Solar Cell
Solar CellSolar Cell
Solar Cell
 
Barcode Decoder
Barcode DecoderBarcode Decoder
Barcode Decoder
 
Conditional Probability
Conditional ProbabilityConditional Probability
Conditional Probability
 
Isomerism of Transition Metal Complex
Isomerism of Transition Metal ComplexIsomerism of Transition Metal Complex
Isomerism of Transition Metal Complex
 
Space Solar Power
Space Solar PowerSpace Solar Power
Space Solar Power
 
Types of function call
Types of function callTypes of function call
Types of function call
 
Power Series - Legendre Polynomial - Bessel's Equation
Power Series - Legendre Polynomial - Bessel's EquationPower Series - Legendre Polynomial - Bessel's Equation
Power Series - Legendre Polynomial - Bessel's Equation
 

Recently uploaded

INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 

Recently uploaded (20)

INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 

Dijkstra's Algorithm Explained

  • 1. DIJKSTRA’S ALGORITHM Represented by Group: 3 • Arijit Dhali • Ipsita Raha Department : Electronic & Communication Engineering Year : 2nd Session : 2021-22 Data Structure and Algorithm ES – CSS 301
  • 2. TABLE OF CONTENTS 01 Understanding Dijkstra 02 Algorithm and Pseudocode 03 Decoding 04 Complexity
  • 3. What is Dijkstra’s Algorithm ? Dijkstra's algorithm is an algorithm that allows us to find the shortest path between any two vertices of a graph. DIJKSTRA’S ALGORITHM
  • 4. Dijkstra's Algorithm works on the basis that any subpath B -> D of the shortest path A -> D between vertices A and D is also the shortest path between vertices B and D. Dijkstra used this property in the opposite direction i.e we overestimate the distance of each vertex from the starting vertex. Then we visit each node and its neighbors to find the shortest subpath to those neighbors. The algorithm uses a greedy approach in the sense that we find the next best solution hoping that the end result is the best solution for the whole problem. HOW DIJKSTRA’S ALGORITHM WORK?
  • 6.
  • 7. We need to maintain the path distance of every vertex. We can store that in an array of size v, where v is the number of vertices. We also want to be able to get the shortest path, not only know the length of the shortest path. For this, we map each vertex to the vertex that last updated its path length. Once the algorithm is over, we can backtrack from the destination vertex to the source vertex to find the path. A minimum priority queue can be used to efficiently receive the vertex with least path distance. PSEUDOCODE OF DIJKSTRA
  • 8. 1 function Dijkstra(Graph, source): 2 3 create vertex set Q 4 5 for each vertex v in Graph: 6 dist[v] ← INFINITY 7 prev[v] ← UNDEFINED 8 add v to Q 9 dist[source] ← 0 10 11 while Q is not empty: 12 u ← vertex in Q with min dist[u] 13 14 remove u from Q 15 16 for each neighbor v of u still in Q: 17 alt ← dist[u] + length(u, v) 18 if alt < dist[v]: 19 dist[v] ← alt 20 prev[v] ← u 21 22 return dist[], prev[] PSEUDOCODE
  • 9. CODE FOR DIJKSTRA’S ALGORITHM The implementation of Dijkstra's Algorithm in C is given. The complexity of the code can be improved, but the abstractions are convenient to relate the code with the algorithm. Scan this QR Code using Google Lens to get access to the drive containing necessary coding files Log in using College ID
  • 10. Time Complexity: O(E Log V) where, E is the number of edges and V is the number of vertices. Space Complexity: O(V) DIJKSTRA’S ALGORITHM COMPLEXITY
  • 11. APPLICATIONS OF DIJKSTRA’S ALGORITHM • To find the shortest path • In social networking applications • In a telephone network • To find the locations in the map
  • 12. CONCLUSION When the algorithm finishes, each vertex reachable from the source has v. distance set to the length of the shortest path from the source, and v. parent set to its parent in the tree of shortest paths.
  • 13. • https://www.programiz.com/dsa/dijkstra-algorithm • https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm • https://www.quora.com/What-is-the-conclusion-of-Dijkstras-algorithm BIBLIOGRAPHY
  • 14. For your precious time towards our presentation THANK YOU!