Bellman Ford
Single Source Shortest Path on a DAG
Dijkstra
IE170: Algorithms in Systems Engineering:
Lecture 22
Jeﬀ Linderoth
Department of Industrial and Systems Engineering
Lehigh University
March 23, 2007
Jeﬀ Linderoth
IE170:Lecture 22
Bellman Ford
Single Source Shortest Path on a DAG
Dijkstra
Taking Stock
Last Time
SingleSource Shortest Paths
This Time
AllPairs Shortest Paths
Jeﬀ Linderoth
IE170:Lecture 22
Bellman Ford
Single Source Shortest Path on a DAG
Dijkstra
Review
The Algorithm
AllPairs Shortest Paths
Given directed graph
G
= (
V,E
)
,
w
:
E
→
R

E

. (To ease
notation, we let
V
=
{
1
,
2
,...,n
}
.)
Goal:
Create an
n
×
n
matrix of shortest path distances
δ
(
i,j
)
We could run
BellmanFord
if negative weights edges
Running Time:
O
(

V

2

E

)
.
We could run
Dijkstra
if no negative weight edges
Running Time:
(

V

3
lg

V

)
(with binary heap
implementation)
We’ll see how to do slightly better, by exploiting an analogy
to matrix multiplication
Jeﬀ Linderoth
IE170:Lecture 22
Bellman Ford
Single Source Shortest Path on a DAG
Dijkstra
Review
The Algorithm
New Graph Data Structure
This is maybe the one and only time we are going to use an
adjacency matrix
graph representation.
Given
G
= (
)
and weight function
w
:
E
→
R

E

, create

V
 × 
V

matrix
W
as
w
ij
=
0
i
=
j
w
(
)
(
)
∈
E
∞
(
)
±∈
E
In this case it is useful to consider having 0 weight “loops” on
the nodes (
w
ii
= 0
)
The output of an all pairs shortest path algorithm is a matrix
D
= (
d
)
ij
, where
d
ij
=
δ
(
)
Jeﬀ Linderoth
IE170:Lecture 22
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentBellman Ford
Single Source Shortest Path on a DAG
Dijkstra
Review
The Algorithm
Dynamic Programming: Attempt #1
Subpaths of shortest paths are shortest paths
Let
±
(
m
)
ij
be the shortest path from
i
∈
V
to
j
∈
V
that uses
≤
m
edges
To initialize
±
(0)
ij
=
±
0
i
=
j
∞
i
±
=
j
What is the recursion we are looking for?
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '07
 Ralphs
 Graph Theory, Systems Engineering, Shortest path problem, source shortest path, DAG Dijkstra, Bellman Ford Single

Click to edit the document details