Solutions to Practice Midterm

K. Subramani Department of Computer Science and Electrical Engineering, West Virginia University, Morgantown, WV ksmani@csee.wvu.edu

1. Minimum Spanning Trees

(a) Problem 2.7 - The following algorithm solves the problem: The algorithm definitely produces a con-

Algorithm 1 Minimum Connector with negative edge weights

Function Minimum Connector (G =< V, E >) 1: {The key idea is that we only throw out the positive weighted edges, since throwing out edges with negative

weight increases the cost of the minimum-connector!} 2: for ( i = 1 to m) do 3: if ( w(e_{i}) > 0) then 4: if ( {G − {e_{i}}} is connected ) then 5: G = G − {e_{i}} 6: end if 7: end if 8: end for

nected subgraph. Let us call it G_{A} and denote its weight by w(G_{A}). Let G_{B} denote the optimal weight connector with weight w(G_{B}). Observe that G_{B} must have all the negative weight edges which are present in G and hence G_{A}. Otherwise we can decrease the weight of G_{B} by adding such an edge. So the only way that w(G_{B}) can be less than w(G_{A}) is if G_{A} contains a postive weight edge not in G_{B}. However the removal of such an edge from G disconnects it and thus G_{B} cannot be connected...[Q.E.D.]

(b) Problem 2.8 - Let |c_{e}| denote the weight of the largest negative weight (in magnitude) edge in the given graph G ^{1} Add |c_{e}| + 1 to the weight of every edge in the graph. Let us call the new graph G′.

Claim: 0.1 The edges corresponding to an MST in G′ also correspond to and MST in G.

\underline{Proof}: Identical to the greedy proof of Kruskal’s algorithm! □

(c) Consider the heaviest edge e′ in the MST T of a graph G. Removal of this edge, creates a partition (cut) of the vertex set V \S and S. Now from the Blue-Rule, we know that the lightest weight edge of any cut must be part of the MST; thus e′ is the lightest weight edge crossing S. Consequently, if the minmax spanning tree solution does not include e′, then either it is not connected or the maximum weight of an edge in it has weight greater than the weight of e′. For the second part, consider a triangle with weights 2, 2, 1. The MST solution is {1, 2}, whereas a valid solution to the minmax spanning tree solution is {2, 2}, which is clearly not an MST.

1In other words c_{e} is the smallest weight of any edge in the graph.

2. Shortest Path Trees

(a) Problem 2.23 - We need to consider the following 3 cases:

• Both arcs incident on w are directed out of w. Clearly, d(w) = ∞ and we can work on the subgraph G − w;

• Both arcs are directed into w. Solve the shortest path problem on G − w. Let a and b be the 2 vertices which are connected to w. Then d(w) = min{d(a) + w_{aw}, d(b) + w_{bw}};

• One arc (say e_{1}) enters w, while the other arc (say e_{2}) leaves w. First delete e_{2} and solve the shortest path problem on G − e_{2}. Clearly, we get the correct value of d(w). Now delete e_{2} and solve the shortest path problem on G − e_{1}. We now get the correct distances to all the other vertices in the graph.

The key point is that we solved the shortest path problem on a subgraph of G in all three cases.

(b) Problem 2.27 - Proved in class!

3. Max flows and Min-cuts

(a) Problem 3.3 - It is clear that if there is a path P from r to s in G such that the capacity of every edge is ∞, then there cannot be a maximum flow. We now need to argue that the converse, i.e. if for every path P between r and s, there is at least one graph of finite capacity, then there must exist a finite maximum flow. To see this, let us use the augmentation path algorithm on G. Observe that in each iteration one path is lost and the amount of flow is incremented by the smallest residual capacity of any edge on that path (which is finite). Since the number of paths is finite and in each iteration, the flow increases by at most a finite amount, the claim follows.

(b) Problem 3.7 - Without loss of generality, we assume that the discussion is about (r, s) mincuts. Let us restate Corollary 3.8 from the book:

Corollary: 0.1 Let x⃗ denote a feasible flow and δ(R) denote an (r, s) cut. Then x⃗ is a maximum flow and δ(R) is a min-cut if and only if: x_{e} = u_{e}, ∀e ∈ δ(R) and x_{e} = 0, ∀e ∈ δ(R̄)

In other words, a maximum flow saturates every (r, s) minimum cut. It follows that under any maximum flow every edge e ∈ δ(R_{1}) and every edge e ∈ δ(R_{2}) is saturated.

• Consider any edge e ∈ δ(R_{1} ∪ R_{2}). Clearly e ∈ δ(R_{1}) or e ∈ deta(R_{2}) or both. It is possible that not all edges in {δ(R_{1}) ∪ δ(R_{2})} are in δ(R_{1} ∪ R_{2}), but that is not our concern. It therefore follows that every edge e ∈ δ(R_{1} ∪ R_{2}) is saturated under any flow and hence δ(R_{1} ∪ R_{2}) is a min-cut. ...[Q.E.D.]

• Consider any edge e ∈ δ(R_{1} ∪ R_{2}). e has its tail in both R_{1} and R_{2}; it must be one of the following types: (a) The edge has its head in R_{1}; clearly it must belong to δ(R_{2}); (b)The edge has its head in R_{2}; clearly it must belong to δ(R_{1}; (c) the edge has its head in V \{R_{1} ∪ R_{2}}; in this case e ∈ δ(R_{1}) ∩ δ(R_{2}). In all three cases, e is saturated. It follows that the cut defined by δ(R_{1} ∩ R_{2}) is saturated by any flow and is hence a min-cut.

(c) Problem 3.8 - Form an (r, s) min-cut corresponding to maximum flow x⃗^{1}; let the cut be represented by δ(R_{1}) for suitably chosen R_{1}. From the hypothesis v ∈ R_{1}, since there is an (r, v) path in G(x⃗^{1}).

Similarly form an (r, s) min-cut corresponding to maximum flow x⃗^{2}; let the cut be represented by δ(R_{2}), for suitable chosen R_{2}. From the previous problem, we know that x⃗^{2} can be a maximum flow if and only if it saturate δ(R_{1} ∪ R_{2}); it follows that even under flow x⃗^{2}, v must be reachable from r in G(x⃗^{2}); i.e. there is an x⃗^{2}-incrementing path (r, v).

(d) Problem 3.11 - If there is no x⃗-augmenting path of width ≥ 0, it means that there is no path from r to s in G(x⃗) and it follows that x⃗ is a maximum flow. Let us now consider the case when the maximum width over any x⃗-augmenting is K. Draw the residual graph G(x⃗); also associate the residual capacity with each edge. If the maximum flow in G(x⃗) is y⃗, then the maximum flow in the original graph is x⃗ + y⃗ ^{2} Now in the residual graph the maximum width is K; which means that the smallest weight min-cut ≥ K.m, since a min-cut could have all m edges. It follows that a max-flow in G(x⃗) cannot be larger than K.m, which proves the claim.

2Use a few examples to convince yourself that this is true!