SlideShare a Scribd company logo
4
Most read
6
Most read
9
Most read
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
Dijkstra's Algorithm
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

PPTX
Dijkstra's algorithm presentation
PPTX
Shortest path algorithm
PPTX
Dijkstra’S Algorithm
PPTX
Dijkstra's algorithm
PPTX
Dijkstra’s algorithm
PPTX
Dijkstra s algorithm
PPTX
Dijkstra's Algorithm
PPTX
Dijkstra's Algorithm
Dijkstra's algorithm presentation
Shortest path algorithm
Dijkstra’S Algorithm
Dijkstra's algorithm
Dijkstra’s algorithm
Dijkstra s algorithm
Dijkstra's Algorithm
Dijkstra's Algorithm

What's hot (20)

PPTX
Dijkstra
PDF
Shortest path algorithms
PDF
Shortest Path in Graph
PPTX
Dijkstra algorithm a dynammic programming approach
PPT
Minimum spanning tree
PPT
Graph coloring problem
PPT
Prim's Algorithm on minimum spanning tree
PPT
dijkstra algo.ppt
PPTX
Shortest path problem
PPT
Prim Algorithm and kruskal algorithm
PPTX
Bellman ford Algorithm
PPT
Single source stortest path bellman ford and dijkstra
PPTX
DAA-Floyd Warshall Algorithm.pptx
PPTX
Lecture optimal binary search tree
PPT
Graph algorithm
PPTX
Kruskal Algorithm
PPT
Unit26 shortest pathalgorithm
PPT
Spanning trees
PDF
Longest common subsequence
PPTX
Bfs and Dfs
Dijkstra
Shortest path algorithms
Shortest Path in Graph
Dijkstra algorithm a dynammic programming approach
Minimum spanning tree
Graph coloring problem
Prim's Algorithm on minimum spanning tree
dijkstra algo.ppt
Shortest path problem
Prim Algorithm and kruskal algorithm
Bellman ford Algorithm
Single source stortest path bellman ford and dijkstra
DAA-Floyd Warshall Algorithm.pptx
Lecture optimal binary search tree
Graph algorithm
Kruskal Algorithm
Unit26 shortest pathalgorithm
Spanning trees
Longest common subsequence
Bfs and Dfs
Ad

Similar to Dijkstra's Algorithm (20)

PPTX
Dijkstra Algorithm Presentation -the shortest path finding algorithm.pptx
PDF
01-05-2023, SOL_DU_MBAFT_6202_Dijkstra’s Algorithm Dated 1st May 23.pdf
PPTX
Data structures and algorithms Dijkstra’s Algorithm (1).pptx
PPTX
Deixtras Algorithm.pptxdjjdjdjdjddddddddddddddd
PPT
barrera.ppt
PPT
barrera.ppt
PPTX
SEMINAR ON SHORTEST PATH ALGORITHMS.pptx
PPTX
dms slide discrete mathematics sem 2 engineering
PDF
Dijkstra algorithm
PDF
All pairs shortest path algorithm
PPTX
Algo labpresentation a_group
PPTX
Dijkastra’s algorithm
PPTX
Dijkstras-Algorithm-Finding-the-Shortest-Path.pptx
PPT
Dijsktra’s Sortest path algorithm
PPT
2.3 shortest path dijkstra’s
PPTX
Dijkstra Searching Algorithms Shortest.pptx
PPT
Dijkstra.ppt
PPT
Dijkstra's algorithm for computer science
PPTX
Shortest Path.pptx
PPTX
Networks dijkstra's algorithm- pgsr
Dijkstra Algorithm Presentation -the shortest path finding algorithm.pptx
01-05-2023, SOL_DU_MBAFT_6202_Dijkstra’s Algorithm Dated 1st May 23.pdf
Data structures and algorithms Dijkstra’s Algorithm (1).pptx
Deixtras Algorithm.pptxdjjdjdjdjddddddddddddddd
barrera.ppt
barrera.ppt
SEMINAR ON SHORTEST PATH ALGORITHMS.pptx
dms slide discrete mathematics sem 2 engineering
Dijkstra algorithm
All pairs shortest path algorithm
Algo labpresentation a_group
Dijkastra’s algorithm
Dijkstras-Algorithm-Finding-the-Shortest-Path.pptx
Dijsktra’s Sortest path algorithm
2.3 shortest path dijkstra’s
Dijkstra Searching Algorithms Shortest.pptx
Dijkstra.ppt
Dijkstra's algorithm for computer science
Shortest Path.pptx
Networks dijkstra's algorithm- pgsr
Ad

More from ArijitDhali (20)

PDF
Signal Constellation, Geometric Interpretation of Signals
PDF
Stack Queue SubRoutine
PDF
Overviewing the techniques of Numerical Integration.pdf
PDF
Motorola 68020.pdf
PDF
Stereotactic Radiosurgery in Brain Metastases.pdf
PDF
Active Filters.pdf
PDF
Wideband Frequency Modulation.pdf
PDF
Celebrity Problem.pdf
PDF
SSBSC Single Side Band - Suppressed Carrier Compressed
PDF
Biodiversity Hotspots in India
PDF
LTI Systems - With/Without Memory
PDF
RLC Series Resonance
PDF
Bivariate Discrete Distribution
PDF
Solar Cell
PDF
Barcode Decoder
PPTX
Conditional Probability
PPTX
Isomerism of Transition Metal Complex
PPTX
Space Solar Power
PPTX
Types of function call
PPTX
Power Series - Legendre Polynomial - Bessel's Equation
Signal Constellation, Geometric Interpretation of Signals
Stack Queue SubRoutine
Overviewing the techniques of Numerical Integration.pdf
Motorola 68020.pdf
Stereotactic Radiosurgery in Brain Metastases.pdf
Active Filters.pdf
Wideband Frequency Modulation.pdf
Celebrity Problem.pdf
SSBSC Single Side Band - Suppressed Carrier Compressed
Biodiversity Hotspots in India
LTI Systems - With/Without Memory
RLC Series Resonance
Bivariate Discrete Distribution
Solar Cell
Barcode Decoder
Conditional Probability
Isomerism of Transition Metal Complex
Space Solar Power
Types of function call
Power Series - Legendre Polynomial - Bessel's Equation

Recently uploaded (20)

PPT
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
PDF
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
PPTX
Artificial Intelligence
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPT
Total quality management ppt for engineering students
PPTX
Nature of X-rays, X- Ray Equipment, Fluoroscopy
PDF
Analyzing Impact of Pakistan Economic Corridor on Import and Export in Pakist...
PDF
Soil Improvement Techniques Note - Rabbi
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
737-MAX_SRG.pdf student reference guides
PPTX
introduction to high performance computing
PDF
Visual Aids for Exploratory Data Analysis.pdf
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Information Storage and Retrieval Techniques Unit III
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
Artificial Intelligence
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
Total quality management ppt for engineering students
Nature of X-rays, X- Ray Equipment, Fluoroscopy
Analyzing Impact of Pakistan Economic Corridor on Import and Export in Pakist...
Soil Improvement Techniques Note - Rabbi
Exploratory_Data_Analysis_Fundamentals.pdf
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
Automation-in-Manufacturing-Chapter-Introduction.pdf
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
R24 SURVEYING LAB MANUAL for civil enggi
III.4.1.2_The_Space_Environment.p pdffdf
737-MAX_SRG.pdf student reference guides
introduction to high performance computing
Visual Aids for Exploratory Data Analysis.pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Information Storage and Retrieval Techniques Unit III

Dijkstra's Algorithm

  • 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?
  • 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.
  • 14. For your precious time towards our presentation THANK YOU!