Algorithm Design
Algorithm Design
Algorithm Design
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
402<br />
Chapter 7 Network Flow<br />
~ <strong>Design</strong>ing and Analyzing the <strong>Algorithm</strong><br />
We begin by constructing a flow network that provides an efficient algorithm<br />
for determining whether z has been eliminated. Then, by examining the<br />
minimum cut in this network, we will prove (7.59).<br />
Clearly, if there’s any way for z to end up in first place, we should have<br />
z win all its remaining games. Let’s suppose that this leaves it with m wins.<br />
We now want to carefully a~ocate the wins from all remaining games so that<br />
no other team ends with more than m wins. Allocating wins in this way can<br />
be solved by a maximum-flow computation, via the following basic idea. We<br />
have a source s from which all wins emanate. The i th win can pass through<br />
one of the two teams involved in the i th game. We then impose a capacity<br />
constraint saying that at most m - wx wins can pass through team x.<br />
More concretely, we construct the following flow network G, as shown in<br />
Figure 7.21. First, let S’ = S - {z}, and let g* = ~x,y~s’ gx~ -the total number<br />
of games left between all pairs of teams in S’. We include nodes s and t, a<br />
node vx for each team x ~ S’, and a node Uxy for each pair of teams x, y ~ S’<br />
with a nonzero number of games left to play against each other. We h~ive the<br />
following edges.<br />
o Edges (s, uxy) (wins emanate from s);<br />
o Edges (ux~, Vx) and (ux~, vy) (only x or y can win a game that they play<br />
against each other); and<br />
o Edges (vx, t) (wins are absorbed at t).<br />
Let’s consider what capacities we want to place on these edges. We want<br />
wins to flow from s to uxy at saturation, so we give (s, u~y) a capacity of<br />
We want to ensure that team x cannot win more than m - wx games, so we<br />
,<br />
Balt-Tor<br />
Bait<br />
~ he set T = {NY, Toronto}<br />
roves Boston is<br />
liminated.<br />
Figure 7.21 The flow network for the second example. As the minimum cut indicates,<br />
there is no flow of value g*, and so Boston has been eliminated.<br />
7.12 Baseball Elimination<br />
give the edge (v x, t) a capacity of m - w x. Finally, an edge of the form (Ux~,<br />
should have at least gx3, units of capacity, so that it has the ability to transport<br />
a!l the wins from ux3, on to vx; in fact, our analysis will be the cleanest if we<br />
give it infinite capacity. (We note that the construction stil! works even if this<br />
edge is given only gx7 units of capacity, but the proof of (7.59) will become a<br />
little more complicated.)<br />
Now, if there is a flow of value g*, then it is possible for the outcomes<br />
of all remaining games to yield a situation where no team has more than m<br />
wins; and hence,’if team z wins all its remaining games, it can still achieve at<br />
least a tie for first place. Conversely, if there are outcomes for the remaining<br />
games in which z achieves at least a tie, we can use these outcomes to define<br />
a flow of value g*. For example, in Figure 7.21, which is based on our second<br />
example, the indicated cut shows that the maximum flow has value at most<br />
7, whereas g* = 6 + 1 + 1 = 8.<br />
In summary, we have shown<br />
(7.60) Team z has been eliminated if and only if the maximum flow in G<br />
has value strictly less than g*. Thus we can test in polynomial time whether z<br />
has been eliminated.<br />
Characterizing When a Team Has Been Eliminated<br />
Our network flow construction can also be used to prove (7.59). The idea is that<br />
the Max-Flow Min-Cut Theorem gives a nice "if and only if" characterization<br />
for the existence of flow, and if we interpret this characterization in terms<br />
of our application, we get the comparably nice characterization here. This<br />
illustrates a general way in which one can generate characterization theorems<br />
for problems that are reducible to network flow.<br />
Proof of (7.59). Suppose that z has been eliminated from first place. Then<br />
the maximum s-t flow in G has value g’ < g*; so there is an s-t cut (A, B) of<br />
capacity g’, and (A, B) is a minimum cut. Let T be the set of teams x for which<br />
vx ~ A. We will now prove that T can be used in the "averaging argument" in<br />
(7.59).<br />
First, consider the node u.t:~, and suppose one of x or y is not in T, but<br />
ux3, ~ A. Then the edge (Ux~, vx) would cross from A into B, and hence the<br />
cut (A, B) would have infinite capacity. This contradicts the assumption that<br />
(A, B) is a minimum cut of capacity less than g*. So if one of x or y is not in<br />
T, then ux3, ~ B. On the other hand, suppose both x and y be!ong to T, but<br />
ux3, ~ B. Consider the cut (A’, B’) that we would obtain by adding u~ to the set<br />
A and deleting it from the set B. The capacity of (A’, B’) is simply the capacity<br />
of (A, B), minus the capacity g~ of the edge (s, uxy)--for this edge (s, Uxy) used<br />
403