University of Waterloo
Fall 2007
Instructor: Ashwin Nayak
Solutions to Midterm Examination
October 22, 2007
Note: these are one of many correct solutions.
Question 1.
Let
D
= (
N,A
) be a digraph with
s,t
∈
N
,
s
n
=
t
, with arclengths
w
∈
R
A
.
Part 1.1
[4 marks] Prove that there is an
st
dipath in
D
if and only if for every (
s,t
)separator
S
⊂
N
,
we have
δ
out
(
S
)
n
=
∅
.
Answer:
(
⇒
) Consider an
st
dipath
P
in
D
, and any (
s,t
)separator
S
. Since
s
∈
S
, and
t
n∈
S
, there is a
±rst node
v
on
P
that is not in
S
. The arc
uv
in
P
incident on
v
belongs to
δ
out
(
S
), so it is nonempty.
(
⇐
) Consider the set
S
of nodes
v
reachable from
s
, i.e., is such that there is an
sv
dipath. Since
s
∈
S
, if
the set
S
does not contain
t
, we have an (
s,t
)separator such that
δ
out
(
S
) =
∅
, a contradiction.
Part 1.2
[3 marks] Suppose there is an
sv
dipath for every
v
∈
N
. De±ne
y
v
as the length of a shortest
sv

dipath in
D
. Prove that if
D
has no negative dicycle, then
y
v
is a feasible potential.
Answer:
We have to show that
y
v
≤
y
u
+
w
uv
for every arc
uv
∈
A
. Since
D
has no negative dicycle, the
length of any
sv
diwalk is at least the length of the shortest
sv
dipath. The quantity
y
u
+
w
uv
is the length
of the
sv
diwalk consisting of a shortest
su
dipath followed by the arc
uv
. Therefore,
y
v
≤
y
u
+
w
uv
.
Part 1.3
[3 marks] Suppose the indegree of every node in
D
is at least 1. Prove that
D
contains a dicycle.
Answer:
Consider a longest dipath
P
= (
v
1
,...,v
k
) in
D
. Since the indegree of
v
1
is at least one, there
is a node
z
such that
zv
1
∈
A
. If
z
does not lie on the dipath
P
, we get a longer dipath, a contradiction.
Therefore
z
=
v
i
for some
i
∈ {
v
2
,... ,v
k
}
, and we have a dicycle.
Question 2.
[6 marks] Let
D
= (
N,A
) be a digraph with arclengths
w
∈
R
A
, and
s,t
∈
N,s
n
=
t
.
Describe the steps of the Dual Algorithm which, given a feasible potential
y
∈
R
N
, ±nds either a shortest
st
dipath in
D
, or an (
s,t
)separator
Z
such that
δ
out
D
(
Z
) =
∅
.
Answer:
Let
D
=
(
y
) denote the equality subgraph.
•
Step 1.
If there is an
st
dipath
P
in
D
=
(
y
), then stop, and output
P
.
•
Step 2.
Find an
st
separator
Z
in
D
=
(
y
), with
δ
out
D
=
(
y
)
(
Z
) =
∅
.
•
Step 3.
If
δ
out
D
(
Z
) =
∅
, then stop, and output
Z
.
•
Step 4.
Let
α
= min
b
w
uv
−
(
y
v
−
y
u
) :
uv
∈
δ
out
D
(
Z
)
B
.
For each