SlideShare a Scribd company logo
Dijkstra’s Shortest Path Algorithm
Presented By:
Tamzida Azad
ID: …………..
Section: …………..
Presented To:
Dr. Selina Sharmin
Associate Professor
Department of Computer Science & Engineering
Table of Contents
2
Serial Topic Slide Number
1 Creator of Dijkstra Algorithm 3
2 What is Dijkstra’s Algorithm? 4
4 Dijkstra’s Algorithm 5
5 Pseudo Code 6
6 How Dijkstra’s Algorithm Works? 7
7 Example 8-13
8 Example 14-17
9 Dijkstra’s Algorithm Complexity 20
10 Application of Dijkstra’s Algorithm 21-23
11 Different Shortest Path Algorithm’s Complexity Analysis 24
12 Advantage & Disadvantage of Dijkstra’s Algorithm 25
13 Q/A session 26
Creator of Dijkstra’s Algorithm
 Designed by Dutch physicist Edsger Wybe Dijkstra in 1956
 Received Turing award in 1972 for fundamental contributions to programming
as a high, intellectual challenge
 The Edsger W. Dijkstra Paper Prize in Distributed Computing is given for outstanding papers
on the principles of distributed computing
 Famous Quote:
“Computer Science is no more about computers than astronomy is about telescopes."
3
Edsger Wybe Dijkstra
Why Dijkstra’s Algorithm?
 Used to solve the single source shortest path problem
 Finds the shortest distance between two vertices on a graph
 Creates tree of shortest paths from starting source vertex to all other points in the graph
 Works on both directed and undirected graphs
 Differs from minimum spanning tree
 Similar to BFS
 Gives optimal solution using greedy method
4
Dijkstra’s Algorithm
 Approach: Greedy
 Input: Weighted graph G={E,V} and source vertex v∈V, such that all edge weights are
nonnegative
 Output: Lengths of shortest paths (or the shortest paths themselves) from a given source
vertex v∈V to all other vertices
5
6
Dijkstra’s Algorithm Pseudo Code
7
How Dijkstra’s Algorithm Works
Example of Dijkstra’s Algorithm
8
Example Continues…
9
Example Continues…
10
Example Continues…
11
Example Continues…
12
Example Continues…
13
Example Continues…
14
Example Continues…
15
Example Continues…
16
Example Continues…
17
Dijkstra's Algorithm Complexity
 Time Complexity: O(𝑉2
)
With min priority queue time complexity is O(V + E Log V)
E = Number of edges and
V = Number of vertices
 Space Complexity: O(V)
18
19
Digital Mapping Services in Google Maps
 Used to find the minimum distance between two
locations along the path.
 Example:
Finding shortest route between Uttara to
Mohammadpur using Google Map.
20
Social Networking Applications
 Apps suggesting friends to connect
 Uses the shortest path between users measured
through handshakes or connections among them.
21
Telephone Network
 Used in network bandwidth measurement
 If a city is a graph, the vertices represent the
switching stations, and the edges represent the
transmission lines.
22
IP routing
 Finds the best path between the source and the
destination router
 Used to update forwarding table
 Provides the shortest cost path from the source
router to other routers
23
24
Comparing Complexity of Different Shortest Path Algorithm
Advantage and Disadvantage of Dijkstra’s Algorithm
Advantage
 O(𝑛2
) so efficient enough to use for relatively
large problems
 Used enormously in Google Map, IP routing,
robotic path detection, file server etc
 Low complexity, optimal and uniform
 Almost linear and works for both directed &
undirected graph.
Disadvantage
 Consume time by doing blind search
 Can not handle negative edges
 Leads to acyclic graphs
25
Any Question
27

More Related Content

What's hot

Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithm
faisal2204
 
Dijkstra's algorithm
Dijkstra's algorithmDijkstra's algorithm
Dijkstra's algorithm
gsp1294
 
Applications of graphs
Applications of graphsApplications of graphs
Applications of graphs
Tech_MX
 
Slides Chapter10.1 10.2
Slides Chapter10.1 10.2Slides Chapter10.1 10.2
Slides Chapter10.1 10.2
showslidedump
 

What's hot (20)

Dijkstra
DijkstraDijkstra
Dijkstra
 
Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithm
 
Dijkstra's algorithm
Dijkstra's algorithmDijkstra's algorithm
Dijkstra's algorithm
 
Shortest path algorithm
Shortest path algorithmShortest path algorithm
Shortest path algorithm
 
Dijkstra.ppt
Dijkstra.pptDijkstra.ppt
Dijkstra.ppt
 
Dijkstra & flooding ppt(Routing algorithm)
Dijkstra & flooding ppt(Routing algorithm)Dijkstra & flooding ppt(Routing algorithm)
Dijkstra & flooding ppt(Routing algorithm)
 
Floyd Warshall Algorithm
Floyd Warshall AlgorithmFloyd Warshall Algorithm
Floyd Warshall Algorithm
 
Applications of graphs
Applications of graphsApplications of graphs
Applications of graphs
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
 
DAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptxDAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptx
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Master theorem
Master theoremMaster theorem
Master theorem
 
Graph theory presentation
Graph theory presentationGraph theory presentation
Graph theory presentation
 
Directed Acyclic Graph
Directed Acyclic Graph Directed Acyclic Graph
Directed Acyclic Graph
 
Slides Chapter10.1 10.2
Slides Chapter10.1 10.2Slides Chapter10.1 10.2
Slides Chapter10.1 10.2
 
Discrete Mathematics Presentation
Discrete Mathematics PresentationDiscrete Mathematics Presentation
Discrete Mathematics Presentation
 
Floyd warshall algorithm
Floyd warshall algorithmFloyd warshall algorithm
Floyd warshall algorithm
 
implementation of travelling salesman problem with complexity ppt
implementation of travelling salesman problem with complexity pptimplementation of travelling salesman problem with complexity ppt
implementation of travelling salesman problem with complexity ppt
 
Bellman ford algorithm
Bellman ford algorithmBellman ford algorithm
Bellman ford algorithm
 
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
 

Similar to Dijkstra's Algorithm

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
asimshahzad8611
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
Srikrishnan Suresh
 

Similar to Dijkstra's Algorithm (20)

Algo labpresentation a_group
Algo labpresentation a_groupAlgo labpresentation a_group
Algo labpresentation a_group
 
Dijkastra’s algorithm
Dijkastra’s algorithmDijkastra’s algorithm
Dijkastra’s algorithm
 
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
 
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
 
barrera.ppt
barrera.pptbarrera.ppt
barrera.ppt
 
barrera.ppt
barrera.pptbarrera.ppt
barrera.ppt
 
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
 
Shortest-Path Problems - Graph Theory in Computer Applications
Shortest-Path Problems - Graph Theory in Computer ApplicationsShortest-Path Problems - Graph Theory in Computer Applications
Shortest-Path Problems - Graph Theory in Computer Applications
 
AN EFFECT OF USING A STORAGE MEDIUM IN DIJKSTRA ALGORITHM PERFORMANCE FOR IDE...
AN EFFECT OF USING A STORAGE MEDIUM IN DIJKSTRA ALGORITHM PERFORMANCE FOR IDE...AN EFFECT OF USING A STORAGE MEDIUM IN DIJKSTRA ALGORITHM PERFORMANCE FOR IDE...
AN EFFECT OF USING A STORAGE MEDIUM IN DIJKSTRA ALGORITHM PERFORMANCE FOR IDE...
 
dijkstra algo.ppt
dijkstra algo.pptdijkstra algo.ppt
dijkstra algo.ppt
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
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
 
Cnetwork
CnetworkCnetwork
Cnetwork
 
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
 
19IS303_22-23_LM11.pdf
19IS303_22-23_LM11.pdf19IS303_22-23_LM11.pdf
19IS303_22-23_LM11.pdf
 
(148065320) dijistra algo
(148065320) dijistra algo(148065320) dijistra algo
(148065320) dijistra algo
 
Node Path Visualizer Using Shortest Path Algorithms
Node Path Visualizer Using Shortest Path AlgorithmsNode Path Visualizer Using Shortest Path Algorithms
Node Path Visualizer Using Shortest Path Algorithms
 
Shortest route finding using an object oriented database approach
Shortest route finding using an object oriented database approachShortest route finding using an object oriented database approach
Shortest route finding using an object oriented database approach
 
Week13 lec1
Week13 lec1Week13 lec1
Week13 lec1
 
Shortest path algorithm
Shortest  path algorithmShortest  path algorithm
Shortest path algorithm
 

Recently uploaded

一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
ewymefz
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
ewymefz
 
Exploratory Data Analysis - Dilip S.pptx
Exploratory Data Analysis - Dilip S.pptxExploratory Data Analysis - Dilip S.pptx
Exploratory Data Analysis - Dilip S.pptx
DilipVasan
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptx
Opendatabay
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
enxupq
 
Investigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_CrimesInvestigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_Crimes
StarCompliance.io
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
enxupq
 
Computer Presentation.pptx ecommerce advantage s
Computer Presentation.pptx ecommerce advantage sComputer Presentation.pptx ecommerce advantage s
Computer Presentation.pptx ecommerce advantage s
MAQIB18
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
yhkoc
 

Recently uploaded (20)

一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 
Tabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflowsTabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflows
 
Using PDB Relocation to Move a Single PDB to Another Existing CDB
Using PDB Relocation to Move a Single PDB to Another Existing CDBUsing PDB Relocation to Move a Single PDB to Another Existing CDB
Using PDB Relocation to Move a Single PDB to Another Existing CDB
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
 
Jpolillo Amazon PPC - Bid Optimization Sample
Jpolillo Amazon PPC - Bid Optimization SampleJpolillo Amazon PPC - Bid Optimization Sample
Jpolillo Amazon PPC - Bid Optimization Sample
 
Exploratory Data Analysis - Dilip S.pptx
Exploratory Data Analysis - Dilip S.pptxExploratory Data Analysis - Dilip S.pptx
Exploratory Data Analysis - Dilip S.pptx
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
 
How can I successfully sell my pi coins in Philippines?
How can I successfully sell my pi coins in Philippines?How can I successfully sell my pi coins in Philippines?
How can I successfully sell my pi coins in Philippines?
 
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
 
Slip-and-fall Injuries: Top Workers' Comp Claims
Slip-and-fall Injuries: Top Workers' Comp ClaimsSlip-and-fall Injuries: Top Workers' Comp Claims
Slip-and-fall Injuries: Top Workers' Comp Claims
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptx
 
Business update Q1 2024 Lar España Real Estate SOCIMI
Business update Q1 2024 Lar España Real Estate SOCIMIBusiness update Q1 2024 Lar España Real Estate SOCIMI
Business update Q1 2024 Lar España Real Estate SOCIMI
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
 
Investigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_CrimesInvestigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_Crimes
 
Supply chain analytics to combat the effects of Ukraine-Russia-conflict
Supply chain analytics to combat the effects of Ukraine-Russia-conflictSupply chain analytics to combat the effects of Ukraine-Russia-conflict
Supply chain analytics to combat the effects of Ukraine-Russia-conflict
 
Pre-ProductionImproveddsfjgndflghtgg.pptx
Pre-ProductionImproveddsfjgndflghtgg.pptxPre-ProductionImproveddsfjgndflghtgg.pptx
Pre-ProductionImproveddsfjgndflghtgg.pptx
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
 
Computer Presentation.pptx ecommerce advantage s
Computer Presentation.pptx ecommerce advantage sComputer Presentation.pptx ecommerce advantage s
Computer Presentation.pptx ecommerce advantage s
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
 

Dijkstra's Algorithm

  • 1. Dijkstra’s Shortest Path Algorithm Presented By: Tamzida Azad ID: ………….. Section: ………….. Presented To: Dr. Selina Sharmin Associate Professor Department of Computer Science & Engineering
  • 2. Table of Contents 2 Serial Topic Slide Number 1 Creator of Dijkstra Algorithm 3 2 What is Dijkstra’s Algorithm? 4 4 Dijkstra’s Algorithm 5 5 Pseudo Code 6 6 How Dijkstra’s Algorithm Works? 7 7 Example 8-13 8 Example 14-17 9 Dijkstra’s Algorithm Complexity 20 10 Application of Dijkstra’s Algorithm 21-23 11 Different Shortest Path Algorithm’s Complexity Analysis 24 12 Advantage & Disadvantage of Dijkstra’s Algorithm 25 13 Q/A session 26
  • 3. Creator of Dijkstra’s Algorithm  Designed by Dutch physicist Edsger Wybe Dijkstra in 1956  Received Turing award in 1972 for fundamental contributions to programming as a high, intellectual challenge  The Edsger W. Dijkstra Paper Prize in Distributed Computing is given for outstanding papers on the principles of distributed computing  Famous Quote: “Computer Science is no more about computers than astronomy is about telescopes." 3 Edsger Wybe Dijkstra
  • 4. Why Dijkstra’s Algorithm?  Used to solve the single source shortest path problem  Finds the shortest distance between two vertices on a graph  Creates tree of shortest paths from starting source vertex to all other points in the graph  Works on both directed and undirected graphs  Differs from minimum spanning tree  Similar to BFS  Gives optimal solution using greedy method 4
  • 5. Dijkstra’s Algorithm  Approach: Greedy  Input: Weighted graph G={E,V} and source vertex v∈V, such that all edge weights are nonnegative  Output: Lengths of shortest paths (or the shortest paths themselves) from a given source vertex v∈V to all other vertices 5
  • 18. Dijkstra's Algorithm Complexity  Time Complexity: O(𝑉2 ) With min priority queue time complexity is O(V + E Log V) E = Number of edges and V = Number of vertices  Space Complexity: O(V) 18
  • 19. 19
  • 20. Digital Mapping Services in Google Maps  Used to find the minimum distance between two locations along the path.  Example: Finding shortest route between Uttara to Mohammadpur using Google Map. 20
  • 21. Social Networking Applications  Apps suggesting friends to connect  Uses the shortest path between users measured through handshakes or connections among them. 21
  • 22. Telephone Network  Used in network bandwidth measurement  If a city is a graph, the vertices represent the switching stations, and the edges represent the transmission lines. 22
  • 23. IP routing  Finds the best path between the source and the destination router  Used to update forwarding table  Provides the shortest cost path from the source router to other routers 23
  • 24. 24 Comparing Complexity of Different Shortest Path Algorithm
  • 25. Advantage and Disadvantage of Dijkstra’s Algorithm Advantage  O(𝑛2 ) so efficient enough to use for relatively large problems  Used enormously in Google Map, IP routing, robotic path detection, file server etc  Low complexity, optimal and uniform  Almost linear and works for both directed & undirected graph. Disadvantage  Consume time by doing blind search  Can not handle negative edges  Leads to acyclic graphs 25
  • 27. 27