SlideShare a Scribd company logo
C#ODE STUDIO
Algorithms L17.1
Algorithms
LECTURE 17
Shortest Paths I
• Properties of shortest paths
• Dijkstra’s algorithm
• Correctness
• Analysis
• Breadth-first search
C#ODE STUDIO
Algorithms L17.2
Paths in graphs
Consider a digraph G = (V, E) with edge-weight
function w : E R. The weight of path p = v1
v2 L vk is defined to be
1
1
1),()(
k
i
ii vvwpw .
C#ODE STUDIO
Algorithms L17.3
Paths in graphs
Consider a digraph G = (V, E) with edge-weight
function w : E R. The weight of path p = v1
v2 L vk is defined to be
1
1
1),()(
k
i
ii vvwpw .
v
1 v
2
v
3 v
4
v
5
4 –2 –5 1
Example:
w(p) = –2
C#ODE STUDIO
Algorithms L17.4
Shortest paths
A shortest path from u to v is a path of
minimum weight from u to v. The shortest-
path weight from u to v is defined as
(u, v) = min{w(p) : p is a path from u to v}.
Note: (u, v) = if no path from u to v exists.
C#ODE STUDIO
Algorithms L17.5
Optimal substructure
Theorem. A subpath of a shortest path is a
shortest path.
C#ODE STUDIO
Algorithms L17.6
Optimal substructure
Theorem. A subpath of a shortest path is a
shortest path.
Proof. Cut and paste:
C#ODE STUDIO
Algorithms L17.7
Optimal substructure
Theorem. A subpath of a shortest path is a
shortest path.
Proof. Cut and paste:
C#ODE STUDIO
Algorithms L17.8
Triangle inequality
Theorem. For all u, v, x V, we have
(u, v) (u, x) + (x, v).
C#ODE STUDIO
Algorithms L17.9
Triangle inequality
Theorem. For all u, v, x V, we have
(u, v) (u, x) + (x, v).
u
Proof.
x
v
(u, v)
(u, x) (x, v)
C#ODE STUDIO
Algorithms L17.10
Well-definedness of shortest
paths
If a graph G contains a negative-weight cycle,
then some shortest paths may not exist.
C#ODE STUDIO
Algorithms L17.11
Well-definedness of shortest
paths
If a graph G contains a negative-weight cycle,
then some shortest paths may not exist.
Example:
u v
…
< 0
C#ODE STUDIO
Algorithms L17.12
Single-source shortest paths
Problem. From a given source vertex s V, find
the shortest-path weights (s, v) for all v V.
If all edge weights w(u, v) are nonnegative, all
shortest-path weights must exist.
IDEA: Greedy.
1. Maintain a set S of vertices whose shortest-
path distances from s are known.
2. At each step add to S the vertex v V – S
whose distance estimate from s is minimal.
3. Update the distance estimates of vertices
adjacent to v.
C#ODE STUDIO
Algorithms L17.13
Dijkstra’s algorithm
d[s] 0
for each v V – {s}
do d[v]
S
Q V ⊳ Q is a priority queue maintaining V – S
C#ODE STUDIO
Algorithms L17.14
Dijkstra’s algorithm
d[s] 0
for each v V – {s}
do d[v]
S
Q V ⊳ Q is a priority queue maintaining V – S
while Q
do u EXTRACT-MIN(Q)
S S {u}
for each v Adj[u]
do if d[v] > d[u] + w(u, v)
then d[v] d[u] + w(u, v)
C#ODE STUDIO
Algorithms L17.15
Dijkstra’s algorithm
d[s] 0
for each v V – {s}
do d[v]
S
Q V ⊳ Q is a priority queue maintaining V – S
while Q
do u EXTRACT-MIN(Q)
S S {u}
for each v Adj[u]
do if d[v] > d[u] + w(u, v)
then d[v] d[u] + w(u, v)
relaxation
step
Implicit DECREASE-KEY
C#ODE STUDIO
Algorithms L17.16
Example of Dijkstra’s
algorithm
A
B D
C E
10
3
1 4 7 9
8
2
2
Graph with
nonnegative
edge weights:
C#ODE STUDIO
Algorithms L17.17
Example of Dijkstra’s
algorithm
A
B D
C E
10
3
1 4 7 9
8
2
2
Initialize:
A B C D EQ:
0
S: {}
0
C#ODE STUDIO
Algorithms L17.18
Example of Dijkstra’s
algorithm
A
B D
C E
10
3
1 4 7 9
8
2
2A B C D EQ:
0
S: { A }
0
“A” EXTRACT-MIN(Q):
C#ODE STUDIO
Algorithms L17.19
Example of Dijkstra’s
algorithm
A
B D
C E
10
3
1 4 7 9
8
2
2A B C D EQ:
0
S: { A }
0
10
3
10
Relax all edges leaving A:
C#ODE STUDIO
Algorithms L17.20
Example of Dijkstra’s
algorithm
A
B D
C E
10
3
1 4 7 9
8
2
2A B C D EQ:
0
S: { A, C }
0
10
3
10
“C” EXTRACT-MIN(Q):
C#ODE STUDIO
Algorithms L17.21
Example of Dijkstra’s
algorithm
A
B D
C E
10
3
1 4 7 9
8
2
2A B C D EQ:
0
S: { A, C }
0
7
3 5
11
10
7 11 5
Relax all edges leaving C:
C#ODE STUDIO
Algorithms L17.22
Example of Dijkstra’s
algorithm
A
B D
C E
10
3
1 4 7 9
8
2
2A B C D EQ:
0
S: { A, C, E }
0
7
3 5
11
10
7 11 5
“E” EXTRACT-MIN(Q):
C#ODE STUDIO
Algorithms L17.23
Example of Dijkstra’s
algorithm
A
B D
C E
10
3
1 4 7 9
8
2
2A B C D EQ:
0
S: { A, C, E }
0
7
3 5
11
10
7 11 5
7 11
Relax all edges leaving E:
C#ODE STUDIO
Algorithms L17.24
Example of Dijkstra’s
algorithm
A
B D
C E
10
3
1 4 7 9
8
2
2A B C D EQ:
0
S: { A, C, E, B }
0
7
3 5
11
10
7 11 5
7 11
“B” EXTRACT-MIN(Q):
C#ODE STUDIO
Algorithms L17.25
Example of Dijkstra’s
algorithm
A
B D
C E
10
3
1 4 7 9
8
2
2A B C D EQ:
0
S: { A, C, E, B }
0
7
3 5
9
10
7 11 5
7 11
Relax all edges leaving B:
9
C#ODE STUDIO
Algorithms L17.26
Example of Dijkstra’s
algorithm
A
B D
C E
10
3
1 4 7 9
8
2
2A B C D EQ:
0
S: { A, C, E, B, D }
0
7
3 5
9
10
7 11 5
7 11
9
“D” EXTRACT-MIN(Q):
C#ODE STUDIO
Algorithms L17.27
Correctness — Part I
Lemma. Initializing d[s] 0 and d[v] for all
v V – {s} establishes d[v] (s, v) for all v V,
and this invariant is maintained over any sequence
of relaxation steps.
C#ODE STUDIO
Algorithms L17.28
Correctness — Part I
Lemma. Initializing d[s] 0 and d[v] for all
v V – {s} establishes d[v] (s, v) for all v V,
and this invariant is maintained over any sequence
of relaxation steps.
Proof. Suppose not. Let v be the first vertex for
which d[v] < (s, v), and let u be the vertex that
caused d[v] to change: d[v] = d[u] + w(u, v). Then,
d[v] < (s, v) supposition
(s, u) + (u, v) triangle inequality
(s,u) + w(u, v) sh. path specific path
d[u] + w(u, v) v is first violation
Contradiction.
C#ODE STUDIO
Algorithms L17.29
Correctness — Part II
Lemma. Let u be v’s predecessor on a shortest
path from s to v. Then, if d[u] = (s, u) and edge
(u, v) is relaxed, we have d[v] (s, v) after the
relaxation.
C#ODE STUDIO
Algorithms L17.30
Correctness — Part II
Lemma. Let u be v’s predecessor on a shortest
path from s to v. Then, if d[u] = (s, u) and edge
(u, v) is relaxed, we have d[v] (s, v) after the
relaxation.
Proof. Observe that (s, v) = (s, u) + w(u, v).
Suppose that d[v] > (s, v) before the relaxation.
(Otherwise, we’re done.) Then, the test d[v] >
d[u] + w(u, v) succeeds, because d[v] > (s, v) =
(s, u) + w(u, v) = d[u] + w(u, v), and the
algorithm sets d[v] = d[u] + w(u, v) = (s, v).
C#ODE STUDIO
Algorithms L17.31
Correctness — Part III
Theorem. Dijkstra’s algorithm terminates with
d[v] = (s, v) for all v V.
C#ODE STUDIO
Algorithms L17.32
Correctness — Part III
Theorem. Dijkstra’s algorithm terminates with
d[v] = (s, v) for all v V.
Proof. It suffices to show that d[v] = (s, v) for every v
V when v is added to S. Suppose u is the first vertex
added to S for which d[u] (s, u). Let y be the first
vertex in V – S along a shortest path from s to u, and
let x be its predecessor:
s
x y
u
S, just before
adding u.
C#ODE STUDIO
Algorithms L17.33
Correctness — Part III
(continued)
Since u is the first vertex violating the claimed
invariant, we have d[x] = (s, x). When x was
added to S, the edge (x, y) was relaxed, which
implies that d[y] = (s, y) (s, u) d[u]. But,
d[u] d[y] by our choice of u. Contradiction.
s
x y
uS
C#ODE STUDIO
Algorithms L17.34
Analysis of Dijkstra
while Q
do u EXTRACT-MIN(Q)
S S {u}
for each v Adj[u]
do if d[v] > d[u] + w(u, v)
then d[v] d[u] + w(u, v)
C#ODE STUDIO
Algorithms L17.35
Analysis of Dijkstra
|V|
times
while Q
do u EXTRACT-MIN(Q)
S S {u}
for each v Adj[u]
do if d[v] > d[u] + w(u, v)
then d[v] d[u] + w(u, v)
C#ODE STUDIO
Algorithms L17.36
Analysis of Dijkstra
degree(u)
times
|V|
times
while Q
do u EXTRACT-MIN(Q)
S S {u}
for each v Adj[u]
do if d[v] > d[u] + w(u, v)
then d[v] d[u] + w(u, v)
C#ODE STUDIO
Algorithms L17.37
Analysis of Dijkstra
degree(u)
times
|V|
times
Handshaking Lemma (E) implicit DECREASE-KEY’s.
while Q
do u EXTRACT-MIN(Q)
S S {u}
for each v Adj[u]
do if d[v] > d[u] + w(u, v)
then d[v] d[u] + w(u, v)
C#ODE STUDIO
Algorithms L17.38
Analysis of Dijkstra
degree(u)
times
|V|
times
Handshaking Lemma (E) implicit DECREASE-KEY’s.
Time = (V·TEXTRACT-MIN + E·TDECREASE-KEY)
Note: Same formula as in the analysis of Prim’s
minimum spanning tree algorithm.
while Q
do u EXTRACT-MIN(Q)
S S {u}
for each v Adj[u]
do if d[v] > d[u] + w(u, v)
then d[v] d[u] + w(u, v)
C#ODE STUDIO
Algorithms L17.39
Analysis of Dijkstra
(continued)
Time = (V)·TEXTRACT-MIN + (E)·TDECREASE-KEY
Q TEXTRACT-MIN TDECREASE-KEY Total
C#ODE STUDIO
Algorithms L17.40
Analysis of Dijkstra
(continued)
Time = (V)·TEXTRACT-MIN + (E)·TDECREASE-KEY
Q TEXTRACT-MIN TDECREASE-KEY Total
array O(V) O(1) O(V2)
C#ODE STUDIO
Algorithms L17.41
Analysis of Dijkstra
(continued)
Time = (V)·TEXTRACT-MIN + (E)·TDECREASE-KEY
Q TEXTRACT-MIN TDECREASE-KEY Total
array O(V) O(1) O(V2)
binary
heap O(lgV) O(lgV) O(Elg V)
C#ODE STUDIO
Algorithms L17.42
Analysis of Dijkstra
(continued)
Time = (V)·TEXTRACT-MIN + (E)·TDECREASE-KEY
Q TEXTRACT-MIN TDECREASE-KEY Total
array O(V) O(1) O(V2)
binary
heap O(lgV) O(lgV) O(Elg V)
Fibonacci
heap
O(lgV)
amortized
O(1)
amortized
O(E + V lg V)
worst case
C#ODE STUDIO
Algorithms L17.43
Unweighted graphs
Suppose that w(u, v) = 1 for all (u, v) E.
Can Dijkstra’s algorithm be improved?
C#ODE STUDIO
Algorithms L17.44
Unweighted graphs
• Use a simple FIFO queue instead of a priority
queue.
Suppose that w(u, v) = 1 for all (u, v) E.
Can Dijkstra’s algorithm be improved?
C#ODE STUDIO
Algorithms L17.45
Unweighted graphs
while Q
do u DEQUEUE(Q)
for each v Adj[u]
do if d[v] =
then d[v] d[u] + 1
ENQUEUE(Q, v)
• Use a simple FIFO queue instead of a priority
queue.
Breadth-first search
Suppose that w(u, v) = 1 for all (u, v) E.
Can Dijkstra’s algorithm be improved?
C#ODE STUDIO
Algorithms L17.46
Unweighted graphs
while Q
do u DEQUEUE(Q)
for each v Adj[u]
do if d[v] =
then d[v] d[u] + 1
ENQUEUE(Q, v)
• Use a simple FIFO queue instead of a priority
queue.
Analysis: Time = O(V + E).
Breadth-first search
Suppose that w(u, v) = 1 for all (u, v) E.
Can Dijkstra’s algorithm be improved?
C#ODE STUDIO
Algorithms L17.47
Example of breadth-first
search
a
b
c
d
e
g
i
f h
Q:
C#ODE STUDIO
Algorithms L17.48
Example of breadth-first
search
a
b
c
d
e
g
i
f h
Q: a
0
0
C#ODE STUDIO
Algorithms L17.49
Example of breadth-first
search
a
b
c
d
e
g
i
f h
Q: a b d
0
1
1
1 1
C#ODE STUDIO
Algorithms L17.50
Example of breadth-first
search
a
b
c
d
e
g
i
f h
Q: a b d c e
0
1
1
2 2
1 2 2
C#ODE STUDIO
Algorithms L17.51
Example of breadth-first
search
a
b
c
d
e
g
i
f h
Q: a b d c e
0
1
1
2 2
2 2
C#ODE STUDIO
Algorithms L17.52
Example of breadth-first
search
a
b
c
d
e
g
i
f h
Q: a b d c e
0
1
1
2 2
2
C#ODE STUDIO
Algorithms L17.53
Example of breadth-first
search
a
b
c
d
e
g
i
f h
Q: a b d c e g i
0
1
1
2 2
3
3
3 3
C#ODE STUDIO
Algorithms L17.54
Example of breadth-first
search
a
b
c
d
e
g
i
f h
Q: a b d c e g i f
0
1
1
2 2
3
3
4
3 4
C#ODE STUDIO
Algorithms L17.55
Example of breadth-first
search
a
b
c
d
e
g
i
f h
Q: a b d c e g i f h
0
1
1
2 2
3
3
4 4
4 4
C#ODE STUDIO
Algorithms L17.56
Example of breadth-first
search
a
b
c
d
e
g
i
f h
Q: a b d c e g i f h
0
1
1
2 2
3
3
4 4
4
C#ODE STUDIO
Algorithms L17.57
Example of breadth-first
search
a
b
c
d
e
g
i
f h
Q: a b d c e g i f h
0
1
1
2 2
3
3
4 4
C#ODE STUDIO
Algorithms L17.58
Example of breadth-first
search
a
b
c
d
e
g
i
f h
Q: a b d c e g i f h
0
1
1
2 2
3
3
4 4
C#ODE STUDIO
Algorithms L17.59
Correctness of BFS
Key idea:
The FIFO Q in breadth-first search mimics
the priority queue Q in Dijkstra.
• Invariant: v comes after u in Q implies that
d[v] = d[u] or d[v] = d[u] + 1.
while Q
do u DEQUEUE(Q)
for each v Adj[u]
do if d[v] =
then d[v] d[u] + 1
ENQUEUE(Q, v)

More Related Content

What's hot

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
Roshan Tailor
 
Bellman ford Algorithm
Bellman ford AlgorithmBellman ford Algorithm
Bellman ford Algorithmtaimurkhan803
 
Medians and order statistics
Medians and order statisticsMedians and order statistics
Medians and order statistics
Rajendran
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
kailash shaw
 
Kruskal Algorithm
Kruskal AlgorithmKruskal Algorithm
Kruskal Algorithm
Bhavik Vashi
 
Lecture 5: Asymptotic analysis of algorithms
Lecture 5: Asymptotic analysis of algorithmsLecture 5: Asymptotic analysis of algorithms
Lecture 5: Asymptotic analysis of algorithms
Vivek Bhargav
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
Md. Shafiuzzaman Hira
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
Amrinder Arora
 
Prims and kruskal algorithms
Prims and kruskal algorithmsPrims and kruskal algorithms
Prims and kruskal algorithms
Saga Valsalan
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
ArijitDhali
 
Graph theory
Graph  theoryGraph  theory
Graph theory
Manash Kumar Mondal
 
Graphs in data structure
Graphs in data structureGraphs in data structure
Graphs in data structure
hamza javed
 
Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithmmeisamstar
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
Yosuke Mizutani
 
Dijkstra's algorithm
Dijkstra's algorithmDijkstra's algorithm
Dijkstra's algorithmgsp1294
 
Graph Traversal Algorithm
Graph Traversal AlgorithmGraph Traversal Algorithm
Graph Traversal Algorithm
jyothimonc
 
Topological Sorting
Topological SortingTopological Sorting
Topological Sorting
ShahDhruv21
 
Depth First Search and Breadth First Search
Depth First Search and Breadth First SearchDepth First Search and Breadth First Search
Depth First Search and Breadth First Search
Nisha Soms
 

What's hot (20)

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
 
Bellman ford Algorithm
Bellman ford AlgorithmBellman ford Algorithm
Bellman ford Algorithm
 
Medians and order statistics
Medians and order statisticsMedians and order statistics
Medians and order statistics
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Kruskal Algorithm
Kruskal AlgorithmKruskal Algorithm
Kruskal Algorithm
 
Lecture 5: Asymptotic analysis of algorithms
Lecture 5: Asymptotic analysis of algorithmsLecture 5: Asymptotic analysis of algorithms
Lecture 5: Asymptotic analysis of algorithms
 
SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS SINGLE-SOURCE SHORTEST PATHS
SINGLE-SOURCE SHORTEST PATHS
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
 
Prims and kruskal algorithms
Prims and kruskal algorithmsPrims and kruskal algorithms
Prims and kruskal algorithms
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
 
Graph theory
Graph  theoryGraph  theory
Graph theory
 
Dijkstra
DijkstraDijkstra
Dijkstra
 
The Floyd–Warshall algorithm
The Floyd–Warshall algorithmThe Floyd–Warshall algorithm
The Floyd–Warshall algorithm
 
Graphs in data structure
Graphs in data structureGraphs in data structure
Graphs in data structure
 
Unit26 shortest pathalgorithm
Unit26 shortest pathalgorithmUnit26 shortest pathalgorithm
Unit26 shortest pathalgorithm
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 
Dijkstra's algorithm
Dijkstra's algorithmDijkstra's algorithm
Dijkstra's algorithm
 
Graph Traversal Algorithm
Graph Traversal AlgorithmGraph Traversal Algorithm
Graph Traversal Algorithm
 
Topological Sorting
Topological SortingTopological Sorting
Topological Sorting
 
Depth First Search and Breadth First Search
Depth First Search and Breadth First SearchDepth First Search and Breadth First Search
Depth First Search and Breadth First Search
 

Viewers also liked

Networks dijkstra's algorithm- pgsr
Networks  dijkstra's algorithm- pgsrNetworks  dijkstra's algorithm- pgsr
Networks dijkstra's algorithm- pgsrLinawati Adiman
 
Dijkstra & flooding ppt(Routing algorithm)
Dijkstra & flooding ppt(Routing algorithm)Dijkstra & flooding ppt(Routing algorithm)
Dijkstra & flooding ppt(Routing algorithm)
Anshul gour
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithmguest862df4e
 
Huffman
HuffmanHuffman
Disk scheduling algorithms
Disk scheduling algorithms Disk scheduling algorithms
Disk scheduling algorithms
Paresh Parmar
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
Suraj Shukla
 
4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashing
Krish_ver2
 
Arrays and addressing modes
Arrays and addressing modesArrays and addressing modes
Arrays and addressing modes
Bilal Amjad
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
Tanmay Baranwal
 
Filehandlinging cp2
Filehandlinging cp2Filehandlinging cp2
Filehandlinging cp2
Tanmay Baranwal
 
Implicit objects advance Java
Implicit objects advance JavaImplicit objects advance Java
Implicit objects advance Java
Darshit Metaliya
 
Translation Lookaside Buffer & Inverted Page Table
Translation Lookaside Buffer & Inverted Page TableTranslation Lookaside Buffer & Inverted Page Table
Translation Lookaside Buffer & Inverted Page Table
Darshit Metaliya
 
Projection of line inclined to both the planes
Projection of line inclined to both the planesProjection of line inclined to both the planes
Projection of line inclined to both the planes
Darshit Metaliya
 
Design Concept software engineering
Design Concept software engineeringDesign Concept software engineering
Design Concept software engineering
Darshit Metaliya
 
Page replacement
Page replacementPage replacement
Page replacement
sashi799
 
Disk scheduling algorithm.52
Disk scheduling algorithm.52Disk scheduling algorithm.52
Disk scheduling algorithm.52myrajendra
 
Longest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) AlgorithmLongest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) Algorithm
Darshit Metaliya
 
Addressing mode of 8051
Addressing mode of 8051Addressing mode of 8051
Addressing mode of 8051
Nitin Ahire
 
Hashing Techniques in Data Structures Part2
Hashing Techniques in Data Structures Part2Hashing Techniques in Data Structures Part2
Hashing Techniques in Data Structures Part2
SHAKOOR AB
 

Viewers also liked (20)

Networks dijkstra's algorithm- pgsr
Networks  dijkstra's algorithm- pgsrNetworks  dijkstra's algorithm- pgsr
Networks dijkstra's algorithm- pgsr
 
Dijkstra & flooding ppt(Routing algorithm)
Dijkstra & flooding ppt(Routing algorithm)Dijkstra & flooding ppt(Routing algorithm)
Dijkstra & flooding ppt(Routing algorithm)
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
 
Huffman
HuffmanHuffman
Huffman
 
Disk scheduling algorithms
Disk scheduling algorithms Disk scheduling algorithms
Disk scheduling algorithms
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashing
 
9 cm402.18
9 cm402.189 cm402.18
9 cm402.18
 
Arrays and addressing modes
Arrays and addressing modesArrays and addressing modes
Arrays and addressing modes
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Filehandlinging cp2
Filehandlinging cp2Filehandlinging cp2
Filehandlinging cp2
 
Implicit objects advance Java
Implicit objects advance JavaImplicit objects advance Java
Implicit objects advance Java
 
Translation Lookaside Buffer & Inverted Page Table
Translation Lookaside Buffer & Inverted Page TableTranslation Lookaside Buffer & Inverted Page Table
Translation Lookaside Buffer & Inverted Page Table
 
Projection of line inclined to both the planes
Projection of line inclined to both the planesProjection of line inclined to both the planes
Projection of line inclined to both the planes
 
Design Concept software engineering
Design Concept software engineeringDesign Concept software engineering
Design Concept software engineering
 
Page replacement
Page replacementPage replacement
Page replacement
 
Disk scheduling algorithm.52
Disk scheduling algorithm.52Disk scheduling algorithm.52
Disk scheduling algorithm.52
 
Longest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) AlgorithmLongest Common Subsequence (LCS) Algorithm
Longest Common Subsequence (LCS) Algorithm
 
Addressing mode of 8051
Addressing mode of 8051Addressing mode of 8051
Addressing mode of 8051
 
Hashing Techniques in Data Structures Part2
Hashing Techniques in Data Structures Part2Hashing Techniques in Data Structures Part2
Hashing Techniques in Data Structures Part2
 

Similar to Dijksatra

Bellman ford algorithm
Bellman ford algorithmBellman ford algorithm
Bellman ford algorithm
Ruchika Sinha
 
Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10Traian Rebedea
 
lecture 21
lecture 21lecture 21
lecture 21sajinsc
 
2.6 all pairsshortestpath
2.6 all pairsshortestpath2.6 all pairsshortestpath
2.6 all pairsshortestpath
Krish_ver2
 
Dijkstra.ppt
Dijkstra.pptDijkstra.ppt
Dijkstra.ppt
Ruchika Sinha
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithmSrikrishnan Suresh
 
04 greedyalgorithmsii
04 greedyalgorithmsii04 greedyalgorithmsii
04 greedyalgorithmsii
LENIN Quintero
 
AAD_Lec-3-B-ShortestPaths.ppt of design and analysis of algorithm
AAD_Lec-3-B-ShortestPaths.ppt  of design and analysis of algorithmAAD_Lec-3-B-ShortestPaths.ppt  of design and analysis of algorithm
AAD_Lec-3-B-ShortestPaths.ppt of design and analysis of algorithm
SantoshDood
 
04 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x204 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x2
MuradAmn
 
Inroduction_To_Algorithms_Lect14
Inroduction_To_Algorithms_Lect14Inroduction_To_Algorithms_Lect14
Inroduction_To_Algorithms_Lect14Naor Ami
 
Lecture_10_Parallel_Algorithms_Part_II.ppt
Lecture_10_Parallel_Algorithms_Part_II.pptLecture_10_Parallel_Algorithms_Part_II.ppt
Lecture_10_Parallel_Algorithms_Part_II.ppt
WahyuAde4
 
Dijkstra algorithm
Dijkstra algorithmDijkstra algorithm
Dijkstra algorithm
rishi ram khanal
 
Bellman ford
Bellman fordBellman ford
Bellman ford
Kiran K
 
dijkstraC.ppt
dijkstraC.pptdijkstraC.ppt
dijkstraC.ppt
ManoRanjani30
 
Dijkstra algorithm
Dijkstra algorithmDijkstra algorithm
Dijkstra algorithm
A. S. M. Shafi
 
Graphs: Finding shortest paths
Graphs: Finding shortest pathsGraphs: Finding shortest paths
Graphs: Finding shortest paths
Fulvio Corno
 
Single source shortes path in dag
Single source shortes path in dagSingle source shortes path in dag
Single source shortes path in dag
Kiran K
 
Problem Solving with Algorithms and Data Structure - Graphs
Problem Solving with Algorithms and Data Structure - GraphsProblem Solving with Algorithms and Data Structure - Graphs
Problem Solving with Algorithms and Data Structure - Graphs
Yi-Lung Tsai
 
Shortest Path Problem.docx
Shortest Path Problem.docxShortest Path Problem.docx
Shortest Path Problem.docx
SeethaDinesh
 

Similar to Dijksatra (20)

Bellman ford algorithm
Bellman ford algorithmBellman ford algorithm
Bellman ford algorithm
 
Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10Algorithm Design and Complexity - Course 10
Algorithm Design and Complexity - Course 10
 
lecture 21
lecture 21lecture 21
lecture 21
 
2.6 all pairsshortestpath
2.6 all pairsshortestpath2.6 all pairsshortestpath
2.6 all pairsshortestpath
 
Dijkstra.ppt
Dijkstra.pptDijkstra.ppt
Dijkstra.ppt
 
All pairs shortest path algorithm
All pairs shortest path algorithmAll pairs shortest path algorithm
All pairs shortest path algorithm
 
04 greedyalgorithmsii
04 greedyalgorithmsii04 greedyalgorithmsii
04 greedyalgorithmsii
 
AAD_Lec-3-B-ShortestPaths.ppt of design and analysis of algorithm
AAD_Lec-3-B-ShortestPaths.ppt  of design and analysis of algorithmAAD_Lec-3-B-ShortestPaths.ppt  of design and analysis of algorithm
AAD_Lec-3-B-ShortestPaths.ppt of design and analysis of algorithm
 
04 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x204 greedyalgorithmsii 2x2
04 greedyalgorithmsii 2x2
 
Inroduction_To_Algorithms_Lect14
Inroduction_To_Algorithms_Lect14Inroduction_To_Algorithms_Lect14
Inroduction_To_Algorithms_Lect14
 
Dijkstra c
Dijkstra cDijkstra c
Dijkstra c
 
Lecture_10_Parallel_Algorithms_Part_II.ppt
Lecture_10_Parallel_Algorithms_Part_II.pptLecture_10_Parallel_Algorithms_Part_II.ppt
Lecture_10_Parallel_Algorithms_Part_II.ppt
 
Dijkstra algorithm
Dijkstra algorithmDijkstra algorithm
Dijkstra algorithm
 
Bellman ford
Bellman fordBellman ford
Bellman ford
 
dijkstraC.ppt
dijkstraC.pptdijkstraC.ppt
dijkstraC.ppt
 
Dijkstra algorithm
Dijkstra algorithmDijkstra algorithm
Dijkstra algorithm
 
Graphs: Finding shortest paths
Graphs: Finding shortest pathsGraphs: Finding shortest paths
Graphs: Finding shortest paths
 
Single source shortes path in dag
Single source shortes path in dagSingle source shortes path in dag
Single source shortes path in dag
 
Problem Solving with Algorithms and Data Structure - Graphs
Problem Solving with Algorithms and Data Structure - GraphsProblem Solving with Algorithms and Data Structure - Graphs
Problem Solving with Algorithms and Data Structure - Graphs
 
Shortest Path Problem.docx
Shortest Path Problem.docxShortest Path Problem.docx
Shortest Path Problem.docx
 

Recently uploaded

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 

Recently uploaded (20)

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 

Dijksatra