SlideShare a Scribd company logo
Shortest path problem
PRESENTED TO:
MAM MERYAM
DEPARTMENT OF
COMPUTER SCIENCE
GROUP MEMBERS:
IFRA ILYAS (470)
AQSA SHAUKAT (586)
PAZEER ZARA (452)
SAMRA ASLAM (427)
AQSA ANWAR (453)
SHORTEST
PATH
PROBLEM
GRAPH:
 A graph is a representation of a set of objects
where some pairs of objects are connected by links.
 Vertices:
The interconnected objects are represented
by mathematical abstractions called vertices.
 Edges:
The links that connect some pairs of vertices
are called edges.
SHORTEST PATH
PROBLEM :
 The shortest path problem is the problem of finding
a path between two vertices in a graph such that
the sum of the weights of its constituent edges is
minimized.

TYPES OF GRAPH:
1. Weighted graph
2. Un-weighted graph
3. Directed graph
4. Un-directed graph
TYPES OF GRAPHS:
 Weighted:
A graph is a
weighted graph if a
number (weight) is
assigned to each edge.
Example:
Such weights might
represent, for example,
costs, lengths or
capacities, etc.
 Un-weighted:
A graph is a un-
weighted graph if a
number(weight) is not
assigned to each edge.
TYPES OF GRAPHS:
 Directed:
An directed
graph is one in which
edges have orientation.
 Un-directed:
An undirected
graph is one in which
edges have no
orientation.
SHORTEST PATH PROBLEM:
 Given the graph below, suppose we wish to
find the shortest path from vertex 1 to vertex
13.
EXAMPLE:
 After some consideration, we may determine
that the shortest path is as follows, with length
14
 Other paths exists, but they are longer
NEGATIVE CYCLES:
 Clearly, if we have negative vertices, it may be
possible to end up in a cycle whereby each pass
through the cycle decreases the total length
 Thus, a shortest length would be undefined for such
a graph
 Consider the shortest path
from vertex 1 to 4...
 We will only consider non-
negative weights.
SHORTEST PATH EXAMPLE:
 Given:
 Weighted Directed graph G = (V, E).
 Source s, destination t.
 Find shortest directed path from s to t.
s
3
t
2
6
7
4
5
23
18
2
9
14
15
5
30
20
44
16
11
6
19
6
Cost of path s-2-3-5-t
= 9 + 23 + 2 + 16
= 48.
DISCUSSION ITEMS
 How many possible paths are there from s
to t?
 Can we safely ignore cycles? If so, how?
 Any suggestions on how to reduce the set of
possibilities?
s
3
t
2
6
7
4
5
23
18
2
9
14
15
5
30
20
44
16
11
6
19
6
KEY OBSERVATION:
 A key observation is that if the shortest path contains
the node v, then:
 It will only contain v once, as any cycles will only add to the
length.
 The path from s to v must be the shortest path to v from s.
 The path from v to t must be the shortest path to t from v.
DIJKSTRA’S ALGORITHM:
 Works when all of the weights are positive.
 Provides the shortest paths from a source to
all other vertices in the graph.
 Can be terminated early once the shortest
path to t is found if desired.
EXAMPLE:
 Consider the graph:
 the distances are appropriately initialized
 all vertices are marked as being unvisited
EXAMPLE:
 Visit vertex 1 and update its neighbours,
marking it as visited
 the shortest paths to 2, 4, and 5 are
updated
EXAMPLE:
 The next vertex we visit is vertex 4
 vertex 5 1 + 11 ≥ 8 don’t update
 vertex 7 1 + 9 < ∞ update
 vertex 8 1 + 8 < ∞ update
EXAMPLE:
 Next, visit vertex 2
 vertex 3 4 + 1 < ∞ update
 vertex 4 already
visited
 vertex 5 4 + 6 ≥ 8 don’t update
 vertex 6 4 + 1 < ∞ update
EXAMPLE:
 Next, we have a choice of either 3 or 6
 We will choose to visit 3
 vertex 5 5 + 2 < 8 update
 vertex 6 5 + 5 ≥ 5 don’t update
EXAMPLE:
 We then visit 6
 vertex 8 5 + 7 ≥ 9 don’t update
 vertex 9 5 + 8 < ∞ update
EXAMPLE:
 Next, we finally visit vertex 5:
 vertices 4 and 6 have already been visited
 vertex 7 7 + 1 < 10 update
 vertex 8 7 + 1 < 9 update
 vertex 9 7 + 8 ≥ 13 don’t update
EXAMPLE:
 Given a choice between vertices 7 and 8, we
choose vertex 7
 vertices 5 has already been visited
 vertex 8 8 + 2 ≥ 8 don’t update
EXAMPLE:
 Next, we visit vertex 8:
 vertex 9 8 + 3 < 13 update
EXAMPLE:
 Finally, we visit the end vertex
 Therefore, the shortest path from 1 to 9 has length
11
EXAMPLE:
 We can find the shortest path by working back from
the final vertex:
 9, 8, 5, 3, 2, 1
 Thus, the shortest path is (1, 2, 3, 5, 8, 9)
Shortest path problem
Ad

More Related Content

What's hot (20)

Dijkstra
DijkstraDijkstra
Dijkstra
jagdeeparora86
 
Dijkstra s algorithm
Dijkstra s algorithmDijkstra s algorithm
Dijkstra s algorithm
mansab MIRZA
 
Floyd warshall algorithm
Floyd warshall algorithmFloyd warshall algorithm
Floyd warshall algorithm
A. S. M. Shafi
 
Floyd Warshall Algorithm
Floyd Warshall AlgorithmFloyd Warshall Algorithm
Floyd Warshall Algorithm
InteX Research Lab
 
Dijkstra's algorithm
Dijkstra's algorithmDijkstra's algorithm
Dijkstra's algorithm
gsp1294
 
Dijkstra’S Algorithm
Dijkstra’S AlgorithmDijkstra’S Algorithm
Dijkstra’S Algorithm
ami_01
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
Hinal Lunagariya
 
Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithm
faisal2204
 
Shortest Path in Graph
Shortest Path in GraphShortest Path in Graph
Shortest Path in Graph
Dr Sandeep Kumar Poonia
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
Md. Shafiuzzaman Hira
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
Tech_MX
 
Dijkstra's Algorithm
Dijkstra's Algorithm Dijkstra's Algorithm
Dijkstra's Algorithm
Rashik Ishrak Nahian
 
Prim's algorithm
Prim's algorithmPrim's algorithm
Prim's algorithm
Pankaj Thakur
 
Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentation
Subid Biswas
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problem
Jayesh Chauhan
 
SINGLE SOURCE SHORTEST PATH.ppt
SINGLE SOURCE SHORTEST PATH.pptSINGLE SOURCE SHORTEST PATH.ppt
SINGLE SOURCE SHORTEST PATH.ppt
shanthishyam
 
Graph colouring
Graph colouringGraph colouring
Graph colouring
Priyank Jain
 
PRIM’S AND KRUSKAL’S ALGORITHM
PRIM’S AND KRUSKAL’S  ALGORITHMPRIM’S AND KRUSKAL’S  ALGORITHM
PRIM’S AND KRUSKAL’S ALGORITHM
JaydeepDesai10
 
Graph Theory Introduction
Graph Theory IntroductionGraph Theory Introduction
Graph Theory Introduction
MANISH T I
 
DAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptxDAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptx
ArbabMaalik
 
Dijkstra s algorithm
Dijkstra s algorithmDijkstra s algorithm
Dijkstra s algorithm
mansab MIRZA
 
Floyd warshall algorithm
Floyd warshall algorithmFloyd warshall algorithm
Floyd warshall algorithm
A. S. M. Shafi
 
Dijkstra's algorithm
Dijkstra's algorithmDijkstra's algorithm
Dijkstra's algorithm
gsp1294
 
Dijkstra’S Algorithm
Dijkstra’S AlgorithmDijkstra’S Algorithm
Dijkstra’S Algorithm
ami_01
 
Dijkstra’s algorithm
Dijkstra’s algorithmDijkstra’s algorithm
Dijkstra’s algorithm
faisal2204
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
Tech_MX
 
Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentation
Subid Biswas
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problem
Jayesh Chauhan
 
SINGLE SOURCE SHORTEST PATH.ppt
SINGLE SOURCE SHORTEST PATH.pptSINGLE SOURCE SHORTEST PATH.ppt
SINGLE SOURCE SHORTEST PATH.ppt
shanthishyam
 
PRIM’S AND KRUSKAL’S ALGORITHM
PRIM’S AND KRUSKAL’S  ALGORITHMPRIM’S AND KRUSKAL’S  ALGORITHM
PRIM’S AND KRUSKAL’S ALGORITHM
JaydeepDesai10
 
Graph Theory Introduction
Graph Theory IntroductionGraph Theory Introduction
Graph Theory Introduction
MANISH T I
 
DAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptxDAA-Floyd Warshall Algorithm.pptx
DAA-Floyd Warshall Algorithm.pptx
ArbabMaalik
 

Viewers also liked (20)

Shortest path algorithm
Shortest  path algorithmShortest  path algorithm
Shortest path algorithm
Subrata Kumer Paul
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
Srikrishnan Suresh
 
Conservation of codon optimality
Conservation of codon optimalityConservation of codon optimality
Conservation of codon optimality
Alistair Martin
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Mohanlal Sukhadia University (MLSU)
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
guest862df4e
 
Shortest Path Problem
Shortest Path ProblemShortest Path Problem
Shortest Path Problem
Guillaume Guérard
 
Dijkstra algorithm
Dijkstra algorithmDijkstra algorithm
Dijkstra algorithm
are you
 
My presentation all shortestpath
My presentation all shortestpathMy presentation all shortestpath
My presentation all shortestpath
Carlostheran
 
Shortest Path Search in Real Road Networks with pgRouting
Shortest Path Search in Real Road Networks with pgRoutingShortest Path Search in Real Road Networks with pgRouting
Shortest Path Search in Real Road Networks with pgRouting
Daniel Kastl
 
Shortest path search for real road networks and dynamic costs with pgRouting
Shortest path search for real road networks and dynamic costs with pgRoutingShortest path search for real road networks and dynamic costs with pgRouting
Shortest path search for real road networks and dynamic costs with pgRouting
antonpa
 
21 All Pairs Shortest Path
21 All Pairs Shortest Path21 All Pairs Shortest Path
21 All Pairs Shortest Path
Andres Mendez-Vazquez
 
Biconnected components (13024116056)
Biconnected components (13024116056)Biconnected components (13024116056)
Biconnected components (13024116056)
Akshay soni
 
Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithm
meisamstar
 
Avl trees
Avl treesAvl trees
Avl trees
Mohd Arif
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
Chhatra Thapa
 
Solving The Shortest Path Tour Problem
Solving The Shortest Path Tour ProblemSolving The Shortest Path Tour Problem
Solving The Shortest Path Tour Problem
Nozir Shokirov
 
Floyd Warshall algorithm easy way to compute - Malinga
Floyd Warshall algorithm easy way to compute - MalingaFloyd Warshall algorithm easy way to compute - Malinga
Floyd Warshall algorithm easy way to compute - Malinga
Malinga Perera
 
The Shortest Route Problem
The Shortest Route ProblemThe Shortest Route Problem
The Shortest Route Problem
Charmaine Xy-Za Yape
 
Minimum spanning Tree
Minimum spanning TreeMinimum spanning Tree
Minimum spanning Tree
Narendra Singh Patel
 
Dynamic Programming
Dynamic ProgrammingDynamic Programming
Dynamic Programming
contact2kazi
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
Srikrishnan Suresh
 
Conservation of codon optimality
Conservation of codon optimalityConservation of codon optimality
Conservation of codon optimality
Alistair Martin
 
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Shortest path (Dijkistra's Algorithm) & Spanning Tree (Prim's Algorithm)
Mohanlal Sukhadia University (MLSU)
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
guest862df4e
 
Dijkstra algorithm
Dijkstra algorithmDijkstra algorithm
Dijkstra algorithm
are you
 
My presentation all shortestpath
My presentation all shortestpathMy presentation all shortestpath
My presentation all shortestpath
Carlostheran
 
Shortest Path Search in Real Road Networks with pgRouting
Shortest Path Search in Real Road Networks with pgRoutingShortest Path Search in Real Road Networks with pgRouting
Shortest Path Search in Real Road Networks with pgRouting
Daniel Kastl
 
Shortest path search for real road networks and dynamic costs with pgRouting
Shortest path search for real road networks and dynamic costs with pgRoutingShortest path search for real road networks and dynamic costs with pgRouting
Shortest path search for real road networks and dynamic costs with pgRouting
antonpa
 
Biconnected components (13024116056)
Biconnected components (13024116056)Biconnected components (13024116056)
Biconnected components (13024116056)
Akshay soni
 
Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithm
meisamstar
 
Solving The Shortest Path Tour Problem
Solving The Shortest Path Tour ProblemSolving The Shortest Path Tour Problem
Solving The Shortest Path Tour Problem
Nozir Shokirov
 
Floyd Warshall algorithm easy way to compute - Malinga
Floyd Warshall algorithm easy way to compute - MalingaFloyd Warshall algorithm easy way to compute - Malinga
Floyd Warshall algorithm easy way to compute - Malinga
Malinga Perera
 
Dynamic Programming
Dynamic ProgrammingDynamic Programming
Dynamic Programming
contact2kazi
 
Ad

Similar to Shortest path problem (20)

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
 
Unit ix graph
Unit   ix    graph Unit   ix    graph
Unit ix graph
Tribhuvan University
 
Unit V - ppt.pptx
Unit V - ppt.pptxUnit V - ppt.pptx
Unit V - ppt.pptx
Kongunadu College of Engineering and Technology
 
Unit 9 graph
Unit   9 graphUnit   9 graph
Unit 9 graph
Dabbal Singh Mahara
 
Ds lec 5_chap4
Ds lec 5_chap4Ds lec 5_chap4
Ds lec 5_chap4
Self-Employed
 
logic.pptx
logic.pptxlogic.pptx
logic.pptx
KENNEDY GITHAIGA
 
DAA_Presentation - Copy.pptx
DAA_Presentation - Copy.pptxDAA_Presentation - Copy.pptx
DAA_Presentation - Copy.pptx
AndrewJohnson866415
 
Weighted graphs
Weighted graphsWeighted graphs
Weighted graphs
Core Condor
 
Graph ds
Graph dsGraph ds
Graph ds
university of Gujrat, pakistan
 
DATA STRUCTURES.pptx
DATA STRUCTURES.pptxDATA STRUCTURES.pptx
DATA STRUCTURES.pptx
KENNEDY GITHAIGA
 
UNIT III.pptx
UNIT III.pptxUNIT III.pptx
UNIT III.pptx
SwarndeviKm
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithm
sakthibalabalamuruga
 
14 chapter9 graph_algorithmstopologicalsort_shortestpath
14 chapter9 graph_algorithmstopologicalsort_shortestpath14 chapter9 graph_algorithmstopologicalsort_shortestpath
14 chapter9 graph_algorithmstopologicalsort_shortestpath
SSE_AndyLi
 
Graph_data_structure_information_engineering.pptx
Graph_data_structure_information_engineering.pptxGraph_data_structure_information_engineering.pptx
Graph_data_structure_information_engineering.pptx
sahilpawar2426
 
Dijkstra Shortest Path Algorithm in Network.ppt
Dijkstra Shortest Path Algorithm in Network.pptDijkstra Shortest Path Algorithm in Network.ppt
Dijkstra Shortest Path Algorithm in Network.ppt
RAJASEKARAN G
 
Dijkstra algorithm ds 57612334t4t44.ppt
Dijkstra algorithm  ds 57612334t4t44.pptDijkstra algorithm  ds 57612334t4t44.ppt
Dijkstra algorithm ds 57612334t4t44.ppt
ssuser7b9bda1
 
Graphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ programGraphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ program
Muhammad Danish Badar
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structure
hafsa komal
 
Algorithms of graph
Algorithms of graphAlgorithms of graph
Algorithms of graph
getacew
 
Applied III Chapter 4(1).pdf
Applied III  Chapter 4(1).pdfApplied III  Chapter 4(1).pdf
Applied III Chapter 4(1).pdf
DawitThomas
 
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
 
14 chapter9 graph_algorithmstopologicalsort_shortestpath
14 chapter9 graph_algorithmstopologicalsort_shortestpath14 chapter9 graph_algorithmstopologicalsort_shortestpath
14 chapter9 graph_algorithmstopologicalsort_shortestpath
SSE_AndyLi
 
Graph_data_structure_information_engineering.pptx
Graph_data_structure_information_engineering.pptxGraph_data_structure_information_engineering.pptx
Graph_data_structure_information_engineering.pptx
sahilpawar2426
 
Dijkstra Shortest Path Algorithm in Network.ppt
Dijkstra Shortest Path Algorithm in Network.pptDijkstra Shortest Path Algorithm in Network.ppt
Dijkstra Shortest Path Algorithm in Network.ppt
RAJASEKARAN G
 
Dijkstra algorithm ds 57612334t4t44.ppt
Dijkstra algorithm  ds 57612334t4t44.pptDijkstra algorithm  ds 57612334t4t44.ppt
Dijkstra algorithm ds 57612334t4t44.ppt
ssuser7b9bda1
 
Graphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ programGraphs and eularian circuit & path with c++ program
Graphs and eularian circuit & path with c++ program
Muhammad Danish Badar
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structure
hafsa komal
 
Algorithms of graph
Algorithms of graphAlgorithms of graph
Algorithms of graph
getacew
 
Applied III Chapter 4(1).pdf
Applied III  Chapter 4(1).pdfApplied III  Chapter 4(1).pdf
Applied III Chapter 4(1).pdf
DawitThomas
 
Ad

Recently uploaded (20)

new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 
Smart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptxSmart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptx
rushikeshnavghare94
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
railway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forgingrailway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forging
Javad Kadkhodapour
 
Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
π0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalizationπ0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalization
NABLAS株式会社
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 
Smart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptxSmart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptx
rushikeshnavghare94
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)QA/QC Manager (Quality management Expert)
QA/QC Manager (Quality management Expert)
rccbatchplant
 
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfRICS Membership-(The Royal Institution of Chartered Surveyors).pdf
RICS Membership-(The Royal Institution of Chartered Surveyors).pdf
MohamedAbdelkader115
 
railway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forgingrailway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forging
Javad Kadkhodapour
 
Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
Mathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdfMathematical foundation machine learning.pdf
Mathematical foundation machine learning.pdf
TalhaShahid49
 
Compiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptxCompiler Design_Lexical Analysis phase.pptx
Compiler Design_Lexical Analysis phase.pptx
RushaliDeshmukh2
 
π0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalizationπ0.5: a Vision-Language-Action Model with Open-World Generalization
π0.5: a Vision-Language-Action Model with Open-World Generalization
NABLAS株式会社
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 

Shortest path problem

  • 3. GROUP MEMBERS: IFRA ILYAS (470) AQSA SHAUKAT (586) PAZEER ZARA (452) SAMRA ASLAM (427) AQSA ANWAR (453)
  • 5. GRAPH:  A graph is a representation of a set of objects where some pairs of objects are connected by links.  Vertices: The interconnected objects are represented by mathematical abstractions called vertices.  Edges: The links that connect some pairs of vertices are called edges.
  • 6. SHORTEST PATH PROBLEM :  The shortest path problem is the problem of finding a path between two vertices in a graph such that the sum of the weights of its constituent edges is minimized. 
  • 7. TYPES OF GRAPH: 1. Weighted graph 2. Un-weighted graph 3. Directed graph 4. Un-directed graph
  • 8. TYPES OF GRAPHS:  Weighted: A graph is a weighted graph if a number (weight) is assigned to each edge. Example: Such weights might represent, for example, costs, lengths or capacities, etc.  Un-weighted: A graph is a un- weighted graph if a number(weight) is not assigned to each edge.
  • 9. TYPES OF GRAPHS:  Directed: An directed graph is one in which edges have orientation.  Un-directed: An undirected graph is one in which edges have no orientation.
  • 10. SHORTEST PATH PROBLEM:  Given the graph below, suppose we wish to find the shortest path from vertex 1 to vertex 13.
  • 11. EXAMPLE:  After some consideration, we may determine that the shortest path is as follows, with length 14  Other paths exists, but they are longer
  • 12. NEGATIVE CYCLES:  Clearly, if we have negative vertices, it may be possible to end up in a cycle whereby each pass through the cycle decreases the total length  Thus, a shortest length would be undefined for such a graph  Consider the shortest path from vertex 1 to 4...  We will only consider non- negative weights.
  • 13. SHORTEST PATH EXAMPLE:  Given:  Weighted Directed graph G = (V, E).  Source s, destination t.  Find shortest directed path from s to t. s 3 t 2 6 7 4 5 23 18 2 9 14 15 5 30 20 44 16 11 6 19 6 Cost of path s-2-3-5-t = 9 + 23 + 2 + 16 = 48.
  • 14. DISCUSSION ITEMS  How many possible paths are there from s to t?  Can we safely ignore cycles? If so, how?  Any suggestions on how to reduce the set of possibilities? s 3 t 2 6 7 4 5 23 18 2 9 14 15 5 30 20 44 16 11 6 19 6
  • 15. KEY OBSERVATION:  A key observation is that if the shortest path contains the node v, then:  It will only contain v once, as any cycles will only add to the length.  The path from s to v must be the shortest path to v from s.  The path from v to t must be the shortest path to t from v.
  • 16. DIJKSTRA’S ALGORITHM:  Works when all of the weights are positive.  Provides the shortest paths from a source to all other vertices in the graph.  Can be terminated early once the shortest path to t is found if desired.
  • 17. EXAMPLE:  Consider the graph:  the distances are appropriately initialized  all vertices are marked as being unvisited
  • 18. EXAMPLE:  Visit vertex 1 and update its neighbours, marking it as visited  the shortest paths to 2, 4, and 5 are updated
  • 19. EXAMPLE:  The next vertex we visit is vertex 4  vertex 5 1 + 11 ≥ 8 don’t update  vertex 7 1 + 9 < ∞ update  vertex 8 1 + 8 < ∞ update
  • 20. EXAMPLE:  Next, visit vertex 2  vertex 3 4 + 1 < ∞ update  vertex 4 already visited  vertex 5 4 + 6 ≥ 8 don’t update  vertex 6 4 + 1 < ∞ update
  • 21. EXAMPLE:  Next, we have a choice of either 3 or 6  We will choose to visit 3  vertex 5 5 + 2 < 8 update  vertex 6 5 + 5 ≥ 5 don’t update
  • 22. EXAMPLE:  We then visit 6  vertex 8 5 + 7 ≥ 9 don’t update  vertex 9 5 + 8 < ∞ update
  • 23. EXAMPLE:  Next, we finally visit vertex 5:  vertices 4 and 6 have already been visited  vertex 7 7 + 1 < 10 update  vertex 8 7 + 1 < 9 update  vertex 9 7 + 8 ≥ 13 don’t update
  • 24. EXAMPLE:  Given a choice between vertices 7 and 8, we choose vertex 7  vertices 5 has already been visited  vertex 8 8 + 2 ≥ 8 don’t update
  • 25. EXAMPLE:  Next, we visit vertex 8:  vertex 9 8 + 3 < 13 update
  • 26. EXAMPLE:  Finally, we visit the end vertex  Therefore, the shortest path from 1 to 9 has length 11
  • 27. EXAMPLE:  We can find the shortest path by working back from the final vertex:  9, 8, 5, 3, 2, 1  Thus, the shortest path is (1, 2, 3, 5, 8, 9)