Professional Documents
Culture Documents
1. (10 points) Let G = (V, E) be an undirected connected graph. Let s be a vertex of G. Let
T be a breadth-first tree obtained by conducting a breadth-first search from s. Recall that
T is a rooted tree with s as the root. For any edge e = {u, v} of G, if e does not belong to
T , there are seemingly two possibilities for e. Either u and v have an ancestor-descendant
relation in T , or u and v have no ancestor-descendant relation in T . In the first case, we call
e a back edge. In the second case, we call e a cross edge. Prove that G does not contain any
back edge with respect to T .
Analogously, if T is the depth-first search tree of G with s as the root, prove that G does not
contain any cross edge with respect to T .
2. (10 points) Let G = (V, E) be an undirected connected graph with weights on the edges.
Let n be the number of vertices in G. Let T be a minimum spanning tree of G computed
by Kruskal’s algorithm. Let c1 ≤ c2 ≤ . . . ≤ cn−1 be the weights of the edges in T in non-
decreasing order. Let T 0 be an arbitrary spanning tree of G. Let c01 ≤ c02 ≤ . . . ≤ c0n−1 be the
weights of the edges in T 0 in non-decreasing order. Prove that ci ≤ c0i for all i ∈ [1, n − 1].
3. (10 points) Run Dijkstra’s algorithm on the following directed graph G. Use vertex a as the
source. Use the same convention and notation as in the lecture notes to show the values of
D[·] and pred[·] for the nodes of G. Show the graph G and the values of D[·] and pred[·] after
removing and processing each vertex from Q as in the lecture notes. Either color the pointer
pred[·] red as in the lecture notes or show the pointer pred[·] as a dashed arrow. A vertex
should be shown shaded if it no longer belongs to Q.
10
30
i
10 1 h
5
2
5 f g
30 1
5
a 30
2
b
20 10 e 8
c
5
1
4 d 1
2
j
40
1
4. (10 points) This question is about the maximum flow algorithm.
(a) Run Ford-Fulkerson’s maximum flow algorithm on the following directed graph G. Use
s as the source and t as the sink. Use the same convention and notation as in the lecture
notes to show:
• The residual graph Gf and the augmenting path selected in Gf .
• The flow values on the edges of G and Gf after using the augmenting path selected
to update the flow.
4
8
d 8 e
10
10 s 5
2 4 t
c 5
a 5 20
4 b 5
(b) Let G = (V, E) be a directed graph. Every edge (u, v) in G is associated with a capacity
c(u, v). There is a subset P of supply vertices in G and another subset Q of demand
vertices in G. The subsets P and Q are disjoint. Each vertex p ∈ P is associated with
a supply s(p) > 0. Each vertex P q ∈ Q is associated
P with a demand d(q) > 0. The
input satisfies the condition that p∈P s(p) = q∈Q d(q). The problem is to determine
whether it is possible to send flows from vertices in P to vertices in Q such that each
vertex p ∈ P produces exactly s(p) units of flow, and each vertex q ∈ Q consumes exactly
d(q) units of flow. Show that this problem can be converted to a maximum flow problem.