You are on page 1of 4

In Class Exercise 4

CE 510 Transportation Network Analysis


Department of Civil and Environmental Engineering
Portland State University

Date April 20, 2017

Shortest Path Optimality Conditions:


2
4 5

1 1 4

6 2
3

Label Correcting Algorithm:


Initialize:
Lr ← 0
Li ← ∞ ∀i ∈ N − r
pi ← −1 ∀i ∈ N
while there exists arc (i, j) ∈ A such that Lj > Li + cij do
Lj ← Li + cij
pj ← i
end while
2
4 3
−1
1 1 4 5
3
2 1
3

1
Label Correcting Algorithm FIFO Variant:
Initialize:
Lr ← 0
Li ← ∞ ∀i ∈ N − r
pi ← −1 ∀i ∈ N
Q←r
while Q 6= φ do
Select i ∈ Q
Q ← Q − {i}
for each arc (i, j) ∈ A(i) do
if Lj > Li + cij then
Lj ← Li + cij
pj ← i
if j ∈
/ Q then
Q←Q∪j
end if
end if
end for
end while
2
4 3
−1
1 1 4 5
3
2 1
3

2
Topological Order:
Initialize:
|B(i)|∀i ∈ N : Initialize the indegree of all nodes
F ← φ, ctr ← 0
for all i ∈ N do
if |B(i)| = 0 then
F =F ∪i
end if
end for
while F 6= φ do
Select i ∈ F , F = F − i, ctr ← ctr + 1
N odeN um[i] ← ctr
for each arc (i, j) ∈ A(i) do
|B(j)| ← |B(j)| − 1
if |B(j)| = 0 then
F =F ∪j
end if
end for
end while
2
4 3
−1
1 1 4 5
3
2 1
3

3
Shortest Path on Topologically Ordered Networks:
Initialize:
Lr ← 0
Li ← ∞ ∀i ∈ N − r
pi ← −1 ∀i ∈ N
NT : List of nodes sorted in increasing order of their topological node number
for each i ∈ NT do
for each arc (i, j) ∈ A(i) do
if Lj > Li + cij then
Lj ← Li + cij
pj ← i
end if
end for
end for
2
4 3
−1
1 1 4 5
3
2 1
3

You might also like