You are on page 1of 3

In Class Exercise 5

CE 510 Transportation Network Analysis


Department of Civil and Environmental Engineering
Portland State University

Date April 25, 2017

Breadth First Search:


Initialize:
Q ← {r}
F ← {r}
pi ← −1 ∀i ∈ N
while Q 6= φ do
Select i ∈ Q
Q ← Q − {i}
S = {(i, j) ∈ A(i) : i ∈ F, j ∈
/ F}
for each arc (i, j) ∈ S do
F = F ∪ {j}
pj ← i
Q ← Q ∪ {j}
end for
end while
1 2 5

3 4 6

7 8 9

1
Depth First Search:
Initialize:
ST ACK ← {r}
F ←φ
pi ← −1 ∀i ∈ N
while ST ACK 6= φ do
Select i ∈ ST ACK
ST ACK ← ST ACK − {i}
if i ∈
/ F then
F = F ∪ {i}
S = {(i, j) ∈ A(i) : i ∈ F, j ∈
/ F}
for each arc (i, j) ∈ S do
pj ← i
ST ACK ← ST ACK ∪ {j}
end for
end if
end while
1 2 5

3 4 6

7 8 9

2
Ford Fulkerson Augmenting Path Algorithm
Initialize:
x ← 0: Initialize all flows to 0
b←0
Create residual network R(x = 0)
while there exists a path P in R from r to s with positive capacity on each arc do
uP ← minimum capacity of all arcs in P
for each forward arc (i, j) ∈ P do
xij = xij + uP
end for
for each reverse arc (j, i) ∈ P do
xij = xij − uP
end for
b ← b + uP
Create residual network R(x)
end while
3

1 2,
2, 2

1 1, 1 4

3, 0
1 2,

You might also like