7. network flow ii - princeton university computer...

77
Lecture slides by Kevin Wayne Copyright © 2005 Pearson-Addison Wesley http://www.cs.princeton.edu/~wayne/kleinberg-tardos Last updated on 4/23/18 5:25 AM 7. N ETWORK F LOW II bipartite matching disjoint paths extensions to max flow survey design airline scheduling image segmentation project selection baseball elimination

Upload: hadan

Post on 17-Apr-2018

223 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Lecture slides by Kevin WayneCopyright © 2005 Pearson-Addison Wesley

http://www.cs.princeton.edu/~wayne/kleinberg-tardos

Last updated on 4/23/18 5:25 AM

7. NETWORK FLOW II

‣ bipartite matching

‣ disjoint paths

‣ extensions to max flow

‣ survey design

‣ airline scheduling

‣ image segmentation

‣ project selection

‣ baseball elimination

Page 2: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Minimum cut application (RAND 1950s)

“Free world” goal. Cut supplies (if Cold War turns into real war).

Figure 2From Harris and Ross [1955]: Schematic diagram of the railway network of the Western So-viet Union and Eastern European countries, with a maximum flow of value 163,000 tons fromRussia to Eastern Europe, and a cut of capacity 163,000 tons indicated as ‘The bottleneck’.

2

rail network connecting Soviet Union with Eastern European countries(map declassified by Pentagon in 1999)

Page 3: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Maximum flow application (Tolstoǐ 1930s)

Soviet Union goal. Maximize flow of supplies to Eastern Europe.

Figure 2From Harris and Ross [1955]: Schematic diagram of the railway network of the Western So-viet Union and Eastern European countries, with a maximum flow of value 163,000 tons fromRussia to Eastern Europe, and a cut of capacity 163,000 tons indicated as ‘The bottleneck’.

3

flow

capacity

rail network connecting Soviet Union with Eastern European countries(map declassified by Pentagon in 1999)

Page 4: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Max-flow and min-cut applications

Max-flow and min-cut problems are widely applicable model.

独Data mining.

独Open-pit mining.

独Bipartite matching.

独Network reliability.

独Baseball elimination.

独Image segmentation.

独Network connectivity.

独Markov random fields.

独Distributed computing.

独Security of statistical data.

独Egalitarian stable matching.

独Network intrusion detection.

独Multi-camera scene reconstruction.

独Sensor placement for homeland security.

独Many, many, more.

4

liver and hepatic vascularization segmentation

Page 5: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

7. NETWORK FLOW II

‣ bipartite matching

‣ disjoint paths

‣ extensions to max flow

‣ survey design

‣ airline scheduling

‣ image segmentation

‣ project selection

‣ baseball eliminationSECTION 7.5

Page 6: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Def. Given an undirected graph G = (V, E), subset of edges M ⊆ E is a matching if each node appears in at most one edge in M.

Max matching. Given a graph G, find a max-cardinality matching.

Matching

6

Page 7: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Bipartite matching

Def. A graph G is bipartite if the nodes can be partitioned into two subsets

L and R such that every edge connects a node in L with a node in R. Bipartite matching. Given a bipartite graph G = (L ∪ R, E), find a max-

cardinality matching.

7

RL

1

2

3

4

5

1'

2'

3'

4'

5'

matching: 1-1', 2-2', 3-4', 4-5'

Page 8: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Bipartite matching: max-flow formulation

独Create digraph Gʹ = (L ∪ R ∪ {s, t}, E ʹ ).

独Direct all edges from L to R, and assign infinite (or unit) capacity.

独Add unit-capacity edges from s to each node in L.

独Add unit-capacity edges from each node in R to t.

8

s

1

3

5

1'

3'

5'

t

2

4

2'

4'

1 1

R

G′

L

Page 9: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Max-flow formulation: proof of correctness

Theorem. Max cardinality of a matching in G = value of max flow in G ʹ.

Pf. ≤

独Given a max matching M of cardinality k.

独Consider flow f that sends 1 unit on each of the k corresponding paths.

独f is a flow of value k. ▪

9

s

1

3

5

1'

3'

5'

t

2

4

2'

4'

1 1

G′G

1

3

5

1'

3'

5'

2

4

2'

4'

Page 10: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Max-flow formulation: proof of correctness

Theorem. Max cardinality of a matching in G = value of max flow in G ʹ.

Pf. ≥

独Let f be a max flow in G ʹ and let k denote its value.

独Integrality theorem ⇒ k is integral and can assume f is 0–1.

独Consider M = set of edges from L to R with f (e) = 1. - each node in L and R participates in at most one edge in M - ⎢M ⎢ = k : apply flow-value lemma to cut (L ∪ {s}, R ∪ {t}) ▪

10

s

1

3

5

1'

3'

5'

t

2

4

2'

4'

1 1

G′ G

1

3

5

1'

3'

5'

2

4

2'

4'

Page 11: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Network flow II: quiz 1

What is running time of Ford–Fulkerson algorithms to find a maximum matching in a bipartite graph with ⎟ L⎟ = ⎟ R⎟ = n ?

A. O(m + n)

B. O(mn)

C. O(mn2)

D. O(m2n)

11

Page 12: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Perfect matchings in bipartite graphs

Def. Given a graph G = (V, E), a subset of edges M ⊆ E is a perfect matchingif each node appears in exactly one edge in M.

Q. When does a bipartite graph have a perfect matching?

Structure of bipartite graphs with perfect matchings.

独Clearly, we must have ⎟ L⎟ = ⎟ R⎟.

独Which other conditions are necessary?

独Which other conditions are sufficient?

12

Page 13: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Perfect matchings in bipartite graphs

Notation. Let S be a subset of nodes, and let N(S) be the set of nodes

adjacent to nodes in S.

Observation. If a bipartite graph G = (L ∪ R, E) has a perfect matching, then ⎟ N(S)⎟ ≥ ⎟ S⎟ for all subsets S ⊆ L.

Pf. Each node in S has to be matched to a different node in N(S). ▪

13

1

2

3

4

5

1'

2'

3'

4'

5'

S = { 2, 4, 5 }N(S) = { 2', 5' }

2

4

5

2'

5'

no perfect matching

Page 14: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Hall’s marriage theorem

Theorem. [Frobenius 1917, Hall 1935] Let G = (L ∪ R, E) be a bipartite graph

with ⎟ L⎟ = ⎟ R⎟. Then, graph G has a perfect matching iff ⎟ N(S)⎟ ≥ ⎟ S⎟ for all

subsets S ⊆ L.

Pf. ⇒ This was the previous observation.

14

1

2

3

4

5

1'

2'

3'

4'

5'

S = { 2, 4, 5 }N(S) = { 2', 5' }

2

4

5

2'

5'

no perfect matching

Page 15: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Hall’s marriage theorem

Pf. ⇐ Suppose G does not have a perfect matching.

独Formulate as a max-flow problem and let (A, B) be a min cut in G ʹ.

独By max-flow min-cut theorem, cap(A, B) < ⎟ L⎟.

独Define LA = L ∩ A, LB = L ∩ B, RA = R ∩ A.

独cap(A, B) = ⎟ LB⎟ + ⎟ RA⎟ ⇒ ⎟ RA⎟ < ⎟ LA⎟.

独Min cut can’t use ∞ edges ⇒ N(LA) ⊆ RA.

独⎟ N(LA)⎟ ≤ ⎟ RA⎟ < ⎟ LA⎟.

独Choose S = LA . ▪

5

4

15

s

1

3

1'

3'

5' t

2

4'

2'

LA = {2, 4, 5}LB = {1, 3}RA = {2', 5'}N(LA) = {2', 5'}

1∞

1

1

1

A

∞G′

Page 16: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Problem. Given a bipartite graph, find a max-cardinality matching.

year worst case technique discovered by

1955 O(m n) augmenting path Ford–Fulkerson

1973 O(m n1/2) blocking flow Hopcroft–Karp, Karzanov

2004 O(n2.378) fast matrix multiplication Mucha–Sankowsi

2013 Õ(m10/7) electrical flow Mądry

20xx

Bipartite matching

16

running time for finding a max-cardinality matching in a bipartite graph with n nodes and m edges

Page 17: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Network flow II: quiz 2

Which of the following are properties of the graph G = (V, E)?

A. G has a perfect matching.

B. Hall’s condition is satisfied: ⎟ N(S)⎟ ≥ ⎟ S⎟ for all subsets S ⊆ V.

C. Both A and B.

D. Neither A nor B.

17

Page 18: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Nonbipartite matching

Problem. Given an undirected graph, find a max-cardinality matching.

独Structure of nonbipartite graphs is more complicated.

独But well understood. [Tutte–Berge formula, Edmonds–Galai]

独Blossom algorithm: O(n4). [Edmonds 1965]

独Best known: O(m n1/2). [Micali–Vazirani 1980, Vazirani 1994]

18

PATHS, TREES, AND FLOWERS

JACK EDMONDS

1. Introduction. A graph G for purposes here is a finite set of elements called vertices and a finite set of elements called edges such that each edge meets exactly two vertices, called the end-points of the edge. An edge is said to join its end-points.

A matching in G is a subset of its edges such that no two meet the same vertex. We describe an efficient algorithm for finding in a given graph a match-ing of maximum cardinality. This problem was posed and partly solved by C. Berge; see Sections 3.7 and 3.8.

Maximum matching is an aspect of a topic, treated in books on graph theory, which has developed during the last 75 years through the work of about a dozen authors. In particular, W. T. Tutte (8) characterized graphs which do not contain a perfect matching, or 1-factor as he calls it—that is a set of edges with exactly one member meeting each vertex. His theorem prompted attempts at finding an efficient construction for perfect matchings.

This and our two subsequent papers will be closely related to other work on the topic. Most of the known theorems follow nicely from our treatment, though for the most part they are not treated explicitly. Our treatment is independent and so no background reading is necessary.

Section 2 is a philosophical digression on the meaning of "efficient algorithm." Section 3 discusses ideas of Berge, Norman, and Rabin with a new proof of Berge's theorem. Section 4 presents the bulk of the matching algorithm. Section 7 discusses some refinements of it.

There is an extensive combinatorial-linear theory related on the one hand to matchings in bipartite graphs and on the other hand to linear programming. It is surveyed, from different viewpoints, by Ford and Fulkerson in (5) and by A. J. Hoffman in (6). They mention the problem of extending this relation-ship to non-bipartite graphs. Section 5 does this, or at least begins to do it. There, the Kônig theorem is generalized to a matching-duality theorem for arbitrary graphs. This theorem immediately suggests a polyhedron which in a subsequent paper (4) is shown to be the convex hull of the vectors associated with the matchings in a graph.

Maximum matching in non-bipartite graphs is at present unusual among combinatorial extremum problems in that it is very tractable and yet not of the "unimodular" type described in (5 and 6).

Received November 22, 1963. Supported by the O.N.R. Logistics Project at Princeton University and the A.R.O.D. Combinatorial Mathematics Project at N.B.S.

449

COMBINATORICA Akad6miai Kiad6 - Springer-Verlag

COMBINATORICA 14 (i) (1994) 71-109

A T H E O R Y OF A L T E R N A T I N G PATHS AND BLOSSOMS F O R P R O V I N G C O R R E C T N E S S OF T H E O(v/-VE) G E N E R A L G R A P H

M A X I M U M M A T C H I N G A L G O R I T H M

VIJAY V. VAZIRANI 1

Received December 30, 1989 Revised June 15, 1993

1. I n t r o d u c t i o n

Finding a maximum matching in a graph is a classical problem in the study of algorithms. In this paper we present new algorithmically relevant combinatorial structure of matchings. This structure yields the first proof of correctness of the general graph matching algorithm of Mieali and Vazirani [14]; this is currently the most efficient known matching algorithm.

Berge's theorem [2], which says that matching M in graph G is a maximum matching if and only if there are no augmenting paths w.r.t, it, gives an iterative schema for finding a maximum matching in G, i.e. successively find augmenting paths. Finding augmenting paths is fairly easy in bipartite graphs; however, not so in general graphs (see [13] for a detailed history of the problem). The first polynomial time algorithm (o(rvI4)) for general graph matching was given by Edmonds [4]. In this paper, Edmonds introduced the notion of blossom (an odd length alternating cycle), and showed that by "shrinking" blossoms, one can find augmenting path efficiently. In this seminal paper, Edmonds also introduced the notion of a polynomial time algorithm.

Over the years, faster implementations of Edmonds' algorithm were given by several authors, including Whitzgall and Zahn [16], Balinski [1], Gabow [6], Lawler [12], and Kameda and Munro [10]. In 1972, Hopcroft and Karp [9] proposed finding augmenting paths in phases; in each phase a maximal set of disjoint minimum length augmenting paths is found. They showed that only O ( v / ~ ) phases are needed, as opposed to O(IV]) iterations in the previously-mentioned schema. They also presented an O(IEI) implementation of a phase in bipartite graphs, thereby giving an O(Iv/~llEi) matching algorithm for such graphs, and left the open problem of

1 Partially supported by an NSF PYI Grant with matching funds from AT&; T Bell Labs at Cornell University

AMS subject classification codes (1991): 05 C 70, 05 C 85

Page 19: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

450 JACK EDMONDS

Section 6 presents a certain invariance property of the dual to maximum matching.

In paper (4), the algorithm is extended from maximizing the cardinality of a matching to maximizing for matchings the sum of weights attached to the edges. At another time, the algorithm will be extended from a capacity of one edge at each vertex to a capacity of dt edges at vertex vt.

This paper is based on investigations begun with G. B. Dantzig while at the RAND Combinatorial Symposium during the summer of 1961. I am indebted to many people, at the Symposium and at the National Bureau of Standards, who have taken an interest in the matching problem. There has been much animated discussion on possible versions of an algorithm.

2. Digression. An explanation is due on the use of the words "efficient algorithm." First, what I present is a conceptual description of an algorithm and not a particular formalized algorithm or "code."

For practical purposes computational details are vital. However, my purpose is only to show as attractively as I can that there is an efficient algorithm. According to the dictionary, "efficient" means "adequate in opera-tion or performance." This is roughly the meaning I want—in the sense that it is conceivable for maximum matching to have no efficient algorithm. Perhaps a better word is "good."

I am claiming, as a mathematical result, the existence of a good algorithm for finding a maximum cardinality matching in a graph.

There is an obvious finite algorithm, but that algorithm increases in difficulty exponentially with the size of the graph. It is by no means obvious whether or not there exists an algorithm whose difficulty increases only algebraically with the size of the graph.

The mathematical significance of this paper rests largely on the assumption that the two preceding sentences have mathematical meaning. I am not prepared to set up the machinery necessary to give them formal meaning, nor is the present context appropriate for doing this, but I should like to explain the idea a little further informally. I t may be that since one is customarily concerned with existence, convergence, finiteness, and so forth, one is not in-clined to take seriously the question of the existence of a better-than-finite algorithm.

The relative cost, in time or whatever, of the various applications of a particular algorithm is a fairly clear notion, at least as a natural phenomenon. Presumably, the notion can be formalized. Here "algorithm" is used in the strict sense co mean the idealization of some physical machinery which gives a definite output, consisting of cost plus the desired result, for each member of a specified domain of inputs, the individual problems.

The problem-domain of applicability for an algorithm often suggests for itself possible measures of size for the individual problems—for maximum matching, for example, the number of edges or the number of vertices in the

Historical significance (Jack Edmonds 1965)

19

Page 20: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

HACKATHON PROBLEM

Hackathon problem.

独Hackathon attended by n Harvard students and n Princeton students.

独Each Harvard student is friends with exactly k > 0 Princeton students; each Princeton student is friends with exactly k Harvard students.

独Is it possible to arrange the hackathon so that each Princeton student

pair programs with a different friend from Harvard?

Mathematical reformulation. Does every k-regularbipartite graph have a perfect matching?

Ex. Boolean hypercube.

2-regular bipartite graph

2

4

1

3

Page 21: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

7. NETWORK FLOW II

‣ bipartite matching

‣ disjoint paths

‣ extensions to max flow

‣ survey design

‣ airline scheduling

‣ image segmentation

‣ project selection

‣ baseball eliminationSECTION 7.6

Page 22: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Edge-disjoint paths

Def. Two paths are edge-disjoint if they have no edge in common.

Edge-disjoint paths problem. Given a digraph G = (V, E) and two nodes s and t, find the max number of edge-disjoint s↝t paths.

Ex. Communication networks.

24

s

2

3

4

5

6

7

t

digraph G

Page 23: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Def. Two paths are edge-disjoint if they have no edge in common.

Edge-disjoint paths problem. Given a digraph G = (V, E) and two nodes s and t, find the max number of edge-disjoint s↝t paths.

Ex. Communication networks.

digraph G2 edge-disjoint paths

s

2

3

4

5

6

7

t

Edge-disjoint paths

25

s

2

3

4

5

6

7

t

Page 24: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Edge-disjoint paths

Max-flow formulation. Assign unit capacity to every edge.

Theorem. Max number of edge-disjoint s↝t paths = value of max flow.

Pf. ≤

独Suppose there are k edge-disjoint s↝t paths P1, …, Pk.

独Set f (e) = 1 if e participates in some path Pj ; else set f (e) = 0.

独Since paths are edge-disjoint, f is a flow of value k. ▪

26

s t

1

1

1

1

1

1

1

1

11

1

1

1

1

Page 25: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Edge-disjoint paths

Max-flow formulation. Assign unit capacity to every edge.

Theorem. Max number of edge-disjoint s↝t paths = value of max flow.

Pf. ≥

独Suppose max flow value is k.

独Integrality theorem ⇒ there exists 0–1 flow f of value k.

独Consider edge (s, u) with f(s, u) = 1. - by flow conservation, there exists an edge (u, v) with f(u, v) = 1 - continue until reach t, always choosing a new edge

独Produces k (not necessarily simple) edge-disjoint paths. ▪

27

can eliminate cycles to get simple paths

in O(mn) time if desired (flow decomposition)

s t

1

1

1

1

1

1

1

1

11

1

1

1

1

Page 26: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Network connectivity

Def. A set of edges F ⊆ E disconnects t from s if every s↝t path uses at least one edge in F.

Network connectivity. Given a digraph G = (V, E) and two nodes s and t, find min number of edges whose removal disconnects t from s.

28

s

2

3

4

5

6

7

t

Page 27: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Menger’s theorem

Theorem. [Menger 1927] The max number of edge-disjoint s↝t pathsequals the min number of edges whose removal disconnects t from s. Pf. ≤

独Suppose the removal of F ⊆ E disconnects t from s, and ⎟ F⎟ = k. 独Every s↝t path uses at least one edge in F.

独Hence, the number of edge-disjoint paths is ≤ k. ▪

29

s

2

3

4

5

6

7

t s

2

3

4

5

6

7

t

Page 28: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

s

2

3

4

5

6

7

t

Menger’s theorem

Theorem. [Menger 1927] The max number of edge-disjoint s↝t pathsequals the min number of edges whose removal disconnects t from s. Pf. ≥

独Suppose max number of edge-disjoint paths is k.

独Then value of max flow = k.

独Max-flow min-cut theorem ⇒ there exists a cut (A, B) of capacity k.

独Let F be set of edges going from A to B.

独⎟ F⎟ = k and disconnects t from s. ▪

30

A

s

2

3

4

5

6

7

t

Page 29: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Network flow II: quiz 3

How to find the max number of edge-disjoint paths in an undirected graph?

A. Solve the edge-disjoint paths problem in a digraph(by replacing each undirected edge with two antiparallel edges).

B. Solve a max flow problem in an undirected graph.

C. Both A and B.

D. Neither A nor B.

31

Page 30: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Edge-disjoint paths in undirected graphs

Def. Two paths are edge-disjoint if they have no edge in common.

Edge-disjoint paths problem in undirected graphs. Given a graph G = (V, E) and two nodes s and t, find the max number of edge-disjoint s–t paths.

32

digraph G

s

2

3

4

5

6

7

t

Page 31: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Edge-disjoint paths in undirected graphs

Def. Two paths are edge-disjoint if they have no edge in common.

Edge-disjoint paths problem in undirected graphs. Given a graph G = (V, E) and two nodes s and t, find the max number of edge-disjoint s–t paths.

33

digraph G(2 edge-disjoint paths)

s

2

3

4

5

6

7

t

Page 32: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Edge-disjoint paths in undirected graphs

Def. Two paths are edge-disjoint if they have no edge in common.

Edge-disjoint paths problem in undirected graphs. Given a graph G = (V, E) and two nodes s and t, find the max number of edge-disjoint s–t paths.

34

digraph G(3 edge-disjoint paths)

s

2

3

4

5

6

7

t

Page 33: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Edge-disjoint paths in undirected graphs

Max-flow formulation. Replace each edge with two antiparallel edges and

assign unit capacity to every edge.

Observation. Two paths P1 and P2 may be edge-disjoint in the digraph but

not edge-disjoint in the undirected graph.

35

if P1 uses edge (u, v) and P2 uses its antiparallel edge (v, u)

s t

1

1

1

1

1

1

1

1

11

1

1

1

1

Page 34: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Edge-disjoint paths in undirected graphs

Max-flow formulation. Replace each edge with two antiparallel edges and

assign unit capacity to every edge.

Lemma. In any flow network, there exists a maximum flow f in which for each pair of antiparallel edges e and eʹ : either f (e) = 0 or f (eʹ) = 0 or both.Moreover, integrality theorem still holds.

Pf. [ by induction on number of such pairs ]

独Suppose f (e) > 0 and f (eʹ) > 0 for a pair of antiparallel edges e and eʹ.

独Set f (e) = f (e) – δ and f (eʹ) = f (eʹ) – δ, where δ = min { f (e), f (eʹ) }.

独f is still a flow of the same value but has one fewer such pair. ▪

36

s t

1

1

1

1

1

1

1

1

11

1

1

1

1

Page 35: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Edge-disjoint paths in undirected graphs

Max-flow formulation. Replace each edge with two antiparallel edges and

assign unit capacity to every edge.

Lemma. In any flow network, there exists a maximum flow f in which for each pair of antiparallel edges e and eʹ : either f (e) = 0 or f (eʹ) = 0 or both.Moreover, integrality theorem still holds.

Theorem. Max number of edge-disjoint s↝t paths = value of max flow.

Pf. Similar to proof in digraphs; use lemma.

37

s t

1

1

1

1

1

1

1

1

11

1

1

1

1

Page 36: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

More Menger theorems

Theorem. Given an undirected graph and two nodes s and t,the max number of edge-disjoint s–t paths equals the min number of edges

whose removal disconnects s and t. Theorem. Given an undirected graph and two nonadjacent nodes s and t,the max number of internally node-disjoint s–t paths equals the min number

of internal nodes whose removal disconnects s and t. Theorem. Given a directed graph with two nonadjacent nodes s and t, the max number of internally node-disjoint s↝t paths equals the min number

of internal nodes whose removal disconnects t from s.

38

Page 37: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

7. NETWORK FLOW II

‣ bipartite matching

‣ disjoint paths

‣ extensions to max flow

‣ survey design

‣ airline scheduling

‣ image segmentation

‣ project selection

‣ baseball eliminationSECTION 7.7

Page 38: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Network flow II: quiz 4

Which extensions to max flow can be easily modeled?

A. Multiple sources and multiple sinks.

B. Undirected graphs.

C. Lower bounds on edge flows.

D. All of the above.

40

Page 39: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Multiple sources and sinks

Def. Given a digraph G = (V, E) with edge capacities c(e) ≥ 0 and multiple

source nodes and multiple sink nodes, find max flow that can be sent from the source nodes to the sink nodes.

41

t1

t2

9 6

7

4

5

23

8

1

10

flow network G

s2

s3

s1

Page 40: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Multiple sources and sinks: max-flow formulation

独Add a new source node s and sink node t.

独For each original source node si add edge (s, si) with capacity ∞.

独For each original sink node tj, add edge (tj, t) with capacity ∞.

Claim. 1–1 correspondence betweens flows in G and Gʹ.

42

s

t

t1

t2

9

6

7

4

5

23

8

1

10

flow network G′

s2

s3

s1

Page 41: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Circulation with supplies and demands

Def. Given a digraph G = (V, E) with edge capacities c(e) ≥ 0 andnode demands d(v), a circulation is a function f(e) that satisfies:

独For each e ∈ E: 0 ≤ f (e) ≤ c(e) (capacity)

独For each v ∈ V: (flow conservation)

43

flow capacity

4 / 10

3 / 3

6 / 6

6 / 7 1 / 7

2 / 4

4 / 4

7 / 9

flow network G

11

0

�7

�8

10

(supply node)

(demand node) (transshipment node)

�6

e BM iQ v

f(e) ��

e Qmi Q7 v

f(e) = d(v)<latexit sha1_base64="tpyTsgza9J5RKtRgIV3bv5MUuLM=">AAACe3icbVBdSyMxFE3Hj1XXj6qPvgTLQhUtM8suK4gg7IuPClsVOqVkMnc0NJMMyU1pGeZ37W/xwVf9FcJmah9s3QsJh3POzc09SSGFxTB8agRLyyurX9bWN75ubm3vNHf3bq12hkOXa6nNfcIsSKGgiwIl3BcGWJ5IuEuGv2v9bgTGCq3+4KSAfs4elMgEZ+ipQfMmti4flEBjhDGWVCiKmlZ0VNGsDUc0Po/PT+mCSTukOptz0Yv6Stujo0GzFXbCadHPIJqBFpnV9WC3sRenmrscFHLJrO1FYYH9khkUXEK1ETsLBeND9gA9DxXLwfbL6e4V/eaZlGba+KOQTtmPHSXLrZ3kiXfmDB/tolaT/9N6DrOzfilU4RAUfx+UOVnHUwdJU2GAo5x4wLgR/q+UPzLDOPq456ZM3y6Az21Sjp0SXKewwEoco2GVTzFazOwzuP3eicJOdPOjdXk2y3ONHJBD0iYR+UUuyRW5Jl3CyV/yTF7Ia+MtaAXHwcm7NWjMevbJXAU//wEXUMDE</latexit><latexit sha1_base64="tpyTsgza9J5RKtRgIV3bv5MUuLM=">AAACe3icbVBdSyMxFE3Hj1XXj6qPvgTLQhUtM8suK4gg7IuPClsVOqVkMnc0NJMMyU1pGeZ37W/xwVf9FcJmah9s3QsJh3POzc09SSGFxT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Xj6qPvgTLQhUtM8suK4gg7IuPClsVOqVkMnc0NJMMyU1pGeZ37W/xwVf9FcJmah9s3QsJh3POzc09SSGFxTB8agRLyyurX9bWN75ubm3vNHf3bq12hkOXa6nNfcIsSKGgiwIl3BcGWJ5IuEuGv2v9bgTGCq3+4KSAfs4elMgEZ+ipQfMmti4flEBjhDGWVCiKmlZ0VNGsDUc0Po/PT+mCSTukOptz0Yv6Stujo0GzFXbCadHPIJqBFpnV9WC3sRenmrscFHLJrO1FYYH9khkUXEK1ETsLBeND9gA9DxXLwfbL6e4V/eaZlGba+KOQTtmPHSXLrZ3kiXfmDB/tolaT/9N6DrOzfilU4RAUfx+UOVnHUwdJU2GAo5x4wLgR/q+UPzLDOPq456ZM3y6Az21Sjp0SXKewwEoco2GVTzFazOwzuP3eicJOdPOjdXk2y3ONHJBD0iYR+UUuyRW5Jl3CyV/yTF7Ia+MtaAXHwcm7NWjMevbJXAU//wEXUMDE</latexit>

Page 42: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Circulation with supplies and demands: max-flow formulation

独Add new source s and sink t.

独For each v with d(v) < 0, add edge (s, v) with capacity −d(v).

独For each v with d(v) > 0, add edge (v, t) with capacity d(v). Claim. G has circulation iff G ʹ has max flow of value D =

44

s

t

10

3

6

7 7

4

4

9

supply7 8 6

demand

10 11

flow network G′ �8

11

�6

10 0

�7

saturates all edges leaving s

and entering t

D =�

v : d(v)>0

d(v) =�

v : d(v)<0

�d(v)

<latexit sha1_base64="EY99dEiZK1gMaTbbHbm9TRq7UCU=">AAACc3icbVBNS8NAEN3G7++qRy+LVdBDSyKCQlUEPehNwarQlLLZTNvFzSbsTool9Df5azx40V/h3U2bg60+WHi8eTOz84JECoOu+1FyZmbn5hcWl5ZXVtfWN8qbW48mTjWHBo9lrJ8DZkAKBQ0UKOE50cCiQMJT8HKV15/6oI2I1QMOEmhFrKtER3CGV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E50cCiQMJT8HKV15/6oI2I1QMOEmhFrKtER3CGVmqXb6+pX6fn1Ddp1M761M9HKhoe9A/pBXWHY+bX/fr/nrPcU81pu1xxa+4I9C/xClIhBe7am6UtP4x5GoFCLpkxTc9NsJUxjYJLGC77qYGE8RfWhaalikVgWtno5iHdt0pIO7G2TyEdqb87MhYZM4gC64wY9sx0LRf/qzVT7Jy2MqGSFEHx8aJOKinGNA+QhkIDRzmwhHEt7F8p7zHNONqYJ7aMZifAJy7JXlMleBzClCrxFTUb2hS96cz+ksejmufWvPvjyuVpkeci2SG75IB45IRckhtyRxqEkzfyTj7JV+nb2XF2nb2x1SkVPdtkAk71Bxo5vCw=</latexit><latexit sha1_base64="EY99dEiZK1gMaTbbHbm9TRq7UCU=">AAACc3icbVBNS8NAEN3G7++qRy+LVdBDSyKCQlUEPehNwarQlLLZTNvFzSbsTool9Df5azx40V/h3U2bg60+WHi8eTOz84JECoOu+1FyZmbn5hcWl5ZXVtfWN8qbW48mTjWHBo9lrJ8DZkAKBQ0UKOE50cCiQMJT8HKV15/6oI2I1QMOEmhFrKtER3CGVmqXb6+pX6fn1Ddp1M761M9HKhoe9A/pBXWHY+bX/fr/nrPcU81pu1xxa+4I9C/xClIhBe7am6UtP4x5GoFCLpkxTc9NsJUxjYJLGC77qYGE8RfWhaalikVgWtno5iHdt0pIO7G2TyEdqb87MhYZM4gC64wY9sx0LRf/qzVT7Jy2MqGSFEHx8aJOKinGNA+QhkIDRzmwhHEt7F8p7zHNONqYJ7aMZifAJy7JXlMleBzClCrxFTUb2hS96cz+ksejmufWvPvjyuVpkeci2SG75IB45IRckhtyRxqEkzfyTj7JV+nb2XF2nb2x1SkVPdtkAk71Bxo5vCw=</latexit>

Page 43: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Circulation with supplies and demands

Integrality theorem. If all capacities and demands are integers, and there

exists a circulation, then there exists one that is integer-valued.

Pf. Follows from max-flow formulation + integrality theorem for max flow.

Theorem. Given (V, E, c, d), there does not exist a circulation iff there exists

a node partition (A, B) such that Σv ∈ B d(v) > cap(A, B). Pf sketch. Look at min cut in G ʹ.

45

demand by nodes in B exceeds supply of nodes in B plus

max capacity of edges going from A to B

Page 44: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Def. Given a digraph G = (V, E) with edge capacities c(e) ≥ 0, lower bounds

�(e) ≥ 0, and node demands d(v), a circulation f(e) is a function that satisfies:

独For each e ∈ E : �(e) ≤ f (e) ≤ c(e) (capacity)

独For each v ∈ V : (flow conservation)

Circulation problem with lower bounds. Given (V, E, �, c, d), does there exist a feasible circulation?

e BM iQ v

f(e) ��

e Qmi Q7 v

f(e) = d(v)<latexit sha1_base64="tpyTsgza9J5RKtRgIV3bv5MUuLM=">AAACe3icbVBdSyMxFE3Hj1XXj6qPvgTLQhUtM8suK4gg7IuPClsVOqVkMnc0NJMMyU1pGeZ37W/xwVf9FcJmah9s3QsJh3POzc09SSGFxTB8agRLyyurX9bWN75ubm3vNHf3bq12hkOXa6nNfcIsSKGgiwIl3BcGWJ5IuEuGv2v9bgTGCq3+4KSAfs4elMgEZ+ipQfMmti4flEBjhDGWVCiKmlZ0VNGsDUc0Po/PT+mCSTukOptz0Yv6Stujo0GzFXbCadHPIJqBFpnV9WC3sRenmrscFHLJrO1FYYH9khkUXEK1ETsLBeND9gA9DxXLwfbL6e4V/eaZlGba+KOQTtmPHSXLrZ3kiXfmDB/tolaT/9N6DrOzfilU4RAUfx+UOVnHUwdJU2GAo5x4wLgR/q+UPzLDOPq456ZM3y6Az21Sjp0SXKewwEoco2GVTzFazOwzuP3eicJOdPOjdXk2y3ONHJBD0iYR+UUuyRW5Jl3CyV/yTF7Ia+MtaAXHwcm7NWjMevbJXAU//wEXUMDE</latexit><latexit sha1_base64="tpyTsgza9J5RK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UUuyRW5Jl3CyV/yTF7Ia+MtaAXHwcm7NWjMevbJXAU//wEXUMDE</latexit><latexit sha1_base64="tpyTsgza9J5RKtRgIV3bv5MUuLM=">AAACe3icbVBdSyMxFE3Hj1XXj6qPvgTLQhUtM8suK4gg7IuPClsVOqVkMnc0NJMMyU1pGeZ37W/xwVf9FcJmah9s3QsJh3POzc09SSGFxTB8agRLyyurX9bWN75ubm3vNHf3bq12hkOXa6nNfcIsSKGgiwIl3BcGWJ5IuEuGv2v9bgTGCq3+4KSAfs4elMgEZ+ipQfMmti4flEBjhDGWVCiKmlZ0VNGsDUc0Po/PT+mCSTukOptz0Yv6Stujo0GzFXbCadHPIJqBFpnV9WC3sRenmrscFHLJrO1FYYH9khkUXEK1ETsLBeND9gA9DxXLwfbL6e4V/eaZlGba+KOQTtmPHSXLrZ3kiXfmDB/tolaT/9N6DrOzfilU4RAUfx+UOVnHUwdJU2GAo5x4wLgR/q+UPzLDOPq456ZM3y6Az21Sjp0SXKewwEoco2GVTzFazOwzuP3eicJOdPOjdXk2y3ONHJBD0iYR+UUuyRW5Jl3CyV/yTF7Ia+MtaAXHwcm7NWjMevbJXAU//wEXUMDE</latexit>

Circulation with supplies, demands, and lower bounds

46

Page 45: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Circulation with supplies, demands, and lower bounds

Max-flow formulation. Model lower bounds as circulation with demands.

独Send �(e) units of flow along edge e.

独Update demands of both endpoints.

Theorem. There exists a circulation in G iff there exists a circulation in Gʹ. Moreover, if all demands, capacities, and lower bounds in G are integers, then there exists a circulation in G that is integer-valued.

Pf sketch. f (e) is a circulation in G iff f ʹ(e) = f (e) – �(e) is a circulation in Gʹ.

47

lower bound upper bound

d(v) d(w)flow network G

v w[2, 9]

capacity

d(v) + 2 d(w) – 2flow network G′

v w7

Page 46: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

7. NETWORK FLOW II

‣ bipartite matching

‣ disjoint paths

‣ extensions to max flow

‣ survey design

‣ airline scheduling

‣ image segmentation

‣ project selection

‣ baseball eliminationSECTION 7.8

Page 47: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Survey design

独Design survey asking n1 consumers about n2 products.

独Can survey consumer i about product j only if they own it.

独Ask consumer i between ci and ciʹ questions.

独Ask between pj and pjʹ consumers about product j. Goal. Design a survey that meets these specs, if possible.

Bipartite perfect matching. Special case when ci = ciʹ = pj = pjʹ = 1.

49

one survey question per product

Page 48: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Survey design

Max-flow formulation. Model as a circulation problem with lower bounds.

独Add edge (i, j) if consumer j owns product i.

独Add edge from s to consumer j.

独Add edge from product i to t.

独Add edge from t to s.

独All demands = 0.

独Integer circulation ⟺ feasible survey design.

50consumers products

[0, ∞]

[0, 1]

[p1, p1ʹ][c1, c1ʹ]

ts

1

3

4

2

all supplies and demands are 0

Page 49: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

7. NETWORK FLOW II

‣ bipartite matching

‣ disjoint paths

‣ extensions to max flow

‣ survey design

‣ airline scheduling

‣ image segmentation

‣ project selection

‣ baseball eliminationSECTION 7.9

Page 50: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Airline scheduling

Airline scheduling.

独Complex computational problem faced by airline carriers.

独Must produce schedules that are efficient in terms of equipment usage,crew allocation, and customer satisfaction.

独One of largest consumers of high-poweredalgorithmic techniques.

“Toy problem.”

独Manage flight crews by reusing them over multiple flights.

独Input: set of k flights for a given day.

独Flight i leaves origin oi at time si and arrives at destination di at time fi.

独Minimize number of flight crews.

52

even in presence of unpredictable events, such as

weather and breakdowns

Page 51: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Airline scheduling

Circulation formulation. [to see if c crews suffice]

独For each flight i, include two nodes ui and vi.

独Add source s with demand −c, and edges (s, ui) with capacity 1.

独Add sink t with demand c, and edges (vi, t) with capacity 1.

独For each i, add edge (ui, vi) with lower bound and capacity 1.

独if flight j reachable from i, add edge (vi, uj) with capacity 1.

53

s

u1

u2

u3

v1

v3

v2

t

[0, 1]

[1, 1]

u4 v4

[0, 1]

[0, 1]

crew can begin day with any flight

flight 2 is performed

crew can end day with any flight

same crew can do flights 2 and 4

−c

c

use c crews

Page 52: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Airline scheduling: running time

Theorem. The airline scheduling problem can be solved in O(k3 log k) time.

Pf.

独k = number of flights.

独c = number of crews (unknown).

独O(k) nodes, O(k2) edges.

独At most k crews needed.

⇒ solve lg k circulation problems.

独Value of the flow is between 0 and k. ⇒ at most k augmentations per circulation problem.

独Overall time = O(k3 log k). Remark. Can solve in O(k3) time by formulating as minimum flow problem.

54

binary search for optimal value c*

Page 53: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Airline scheduling: postmortem

Remark. We solved a toy problem.

Real-world problem models countless other factors:

独Union regulations: e.g., flight crews can only fly certain number of

hours in given interval.

独Need optimal schedule over planning horizon, not just one day.

独Deadheading has a cost.

独Flights don’t always leave or arrive on schedule.

独Simultaneously optimize both flight schedule and fare structure.

Message.

独Our solution is a generally useful technique for efficient reuse of limited

resources but trivializes real airline scheduling problem.

独Flow techniques useful for solving airline scheduling problems(and are widely used in practice).

独Running an airline efficiently is a very difficult problem.

55

Page 54: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

7. NETWORK FLOW II

‣ bipartite matching

‣ disjoint paths

‣ extensions to max flow

‣ survey design

‣ airline scheduling

‣ image segmentation

‣ project selection

‣ baseball eliminationSECTION 7.10

Page 55: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Image segmentation

Image segmentation.

独Divide image into coherent regions.

独Central problem in image processing.

Ex. Separate human and robot from background scene.

57

Page 56: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Image segmentation

Foreground / background segmentation.

独Label each pixel in picture as belonging toforeground or background.

独V = set of pixels, E = pairs of neighboring pixels.

独ai ≥ 0 is likelihood pixel i in foreground.

独bi ≥ 0 is likelihood pixel i in background.

独pij ≥ 0 is separation penalty for labeling one of iand j as foreground, and the other as background.

Goals.

独Accuracy: if ai > bi in isolation, prefer to label i in foreground.

独Smoothness: if many neighbors of i are labeled foreground, we should be inclined to label i as foreground.

独Find partition (A, B) that maximizes:

58

foreground background

i�A

ai +�

j�B

bj ��

(i,j)�E

|A�{i,j}|=1

pij

<latexit sha1_base64="3y2QarQJdBdIekQHDxXFrk+jRrU=">AAACqHicbVFda9swFJW9ry77Stu97eWyMOi+gl1WWiiDdmOwxwyWpiMyRlaUVqksC+l6NLje/9z7fshkOw9LuguSDufcq3t1lBklHUbR7yC8c/fe/QdbD3uPHj95+qy/vXPmitJyMeaFKux5xpxQUosxSlTi3FjB8kyJSXb1udEnP4V1stDfcWlEkrML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fxhHw/jbh8HJ0crPLfKCvCR7JCaH5IR8JSMyJpz8CXrBbvA8fBOOwkn4o0sNg1XNLlmLMPsLVN3NCQ==</latexit>

Page 57: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Formulate as min-cut problem.

独Maximization.

独No source or sink.

独Undirected graph.

Turn into minimization problem.

独Maximizing

独is equivalent to minimizing

独or alternatively

Image segmentation

59

j�B

aj +�

i�A

bi +�

(i,j)�E

|A�{i,j}|=1

pij

<latexit sha1_base64="LoL29igP2g4GVVnrYmd2yByz6mo=">AAACqHicbVFdb9MwFHUyPkb56jbeeLmiQhoMVckE2qQJaQMh8Vgkug7VUeS4t5s724lsB63Kwv/knR+Ck/SBdlzJ9tE598M+zgoprIui30G4de/+g4fbj3qPnzx99ry/s3tu89JwHPNc5uYiYxal0Dh2wkm8KAwylUmcZNefG33yE40Vuf7ulgUmil1qMRecOU+l/V/UliqtFkCFhk81sNTDE3pyAO0BnSxa+ayGLBUdf9DrFL9n1jF+Xe2Ld7B40yZ+AUqnw8MPqBK4PQPKWQG0anRa38JHiOsaCt91Uaf9QTSM2oC7IF6BAVnFKN0Jduks56VC7bhk1k7jqHBJxYwTXGLdo6XFwt+HXeLUQ80U2qRqjarhtWdmMM+NX9pBy/5bUTFl7VJlPlMxd2U3tYb8nzYt3fw4qYQuSoead4PmpQSXQ+M6zIRB7uTSA8aN8HcFfsUM487/zdqUtneBfO0l1U2pBc9nuMFKd+MMa1yMNz27C84Ph3E0jL+9H5wer/zcJi/JK7JPYnJETslXMiJjwsmfoBfsBS/Ct+EonIQ/utQwWNXskbUIs79RJM0H</latexit><latexit sha1_base64="LoL29igP2g4GVVnrYmd2yByz6mo=">AAACqHicbVFdb9MwFHUyPkb56jbeeLmiQhoMVckE2qQJaQMh8Vgkug7VUeS4t5s724lsB63Kwv/knR+Ck/SBdlzJ9tE598M+zgoprIui30G4de/+g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H</latexit><latexit sha1_base64="LoL29igP2g4GVVnrYmd2yByz6mo=">AAACqHicbVFdb9MwFHUyPkb56jbeeLmiQhoMVckE2qQJaQMh8Vgkug7VUeS4t5s724lsB63Kwv/knR+Ck/SBdlzJ9tE598M+zgoprIui30G4de/+g4fbj3qPnzx99ry/s3tu89JwHPNc5uYiYxal0Dh2wkm8KAwylUmcZNefG33yE40Vuf7ulgUmil1qMRecOU+l/V/UliqtFkCFhk81sNTDE3pyAO0BnSxa+ayGLBUdf9DrFL9n1jF+Xe2Ld7B40yZ+AUqnw8MPqBK4PQPKWQG0anRa38JHiOsaCt91Uaf9QTSM2oC7IF6BAVnFKN0Jduks56VC7bhk1k7jqHBJxYwTXGLdo6XFwt+HXeLUQ80U2qRqjarhtWdmMM+NX9pBy/5bUTFl7VJlPlMxd2U3tYb8nzYt3fw4qYQuSoead4PmpQSXQ+M6zIRB7uTSA8aN8HcFfsUM487/zdqUtneBfO0l1U2pBc9nuMFKd+MMa1yMNz27C84Ph3E0jL+9H5wer/zcJi/JK7JPYnJETslXMiJjwsmfoBfsBS/Ct+EonIQ/utQwWNXskbUIs79RJM0H</latexit>

i�A

ai +�

j�B

bj ��

(i,j)�E

|A�{i,j}|=1

pij

<latexit sha1_base64="3y2QarQJdBdIekQHDxXFrk+jRrU=">AAACqHicbVFda9swFJW9ry77Stu97eWyMOi+gl1WWiiDdmOwxwyWpiMyRlaUVqksC+l6NLje/9z7fshkOw9LuguSDufcq3t1lBklHUbR7yC8c/fe/QdbD3uPHj95+qy/vXPmitJyMeaFKux5xpxQUosxSlTi3FjB8kyJSXb1udEnP4V1stDfcWlEkrMLLeeSM/RU2v9FXZmnlQQqNZzWwFIPj+nxW2gP6ORFK3+qIUsXHf++1yl+zxwyflXtyXeweN0mfgFKp8P9A5EncHMKlDMDtGp0Wt/AR4jrGoxvuqjT/iAaRm3AbRCvwICsYpRuBzt0VvAyFxq5Ys5N48hgUjGLkitR92jphPHzsAsx9VCzXLikao2q4ZVnZjAvrF8aoWX/rahY7twyz3xmzvDSbWoN+T9tWuL8KKmkNiUKzbtG81IBFtC4DjNpBUe19IBxK/2swC+ZZRz936x1ae82gq+9pLouteTFTGywCq/RssbFeNOz2+BsfxhHw/jbh8HJ0crPLfKCvCR7JCaH5IR8JSMyJpz8CXrBbvA8fBOOwkn4o0sNg1XNLlmLMPsLVN3NCQ==</latexit><latexit sha1_base64="3y2QarQJdBdIekQHDxXFrk+jRrU=">AAACqHicbVFda9swFJW9ry77Stu97eWyMOi+gl1WWiiDdmOwxwyWpiMyRlaUVqksC+l6NLje/9z7fshkOw9LuguSDufcq3t1lBklHUbR7yC8c/fe/QdbD3uPHj95+qy/vXPmitJyMeaFKux5xpxQUosxSlTi3FjB8kyJSXb1udEnP4V1stDfcWlEkrMLLeeSM/RU2v9FXZmnlQQqNZzWwFIPj+nxW2gP6ORFK3+qIUsXHf++1yl+zxwyflXtyXeweN0mfgFKp8P9A5EncHMKlDMDtGp0Wt/AR4jrGoxvuqjT/iAaRm3AbRCvwICsYpRuBzt0VvAyFxq5Ys5N48hgUjGLkitR92jphPHzsAsx9VCzXLikao2q4ZVnZjAvrF8aoWX/rahY7twyz3xmzvDSbWoN+T9tWuL8KKmkNiUKzbtG81IBFtC4DjNpBUe19IBxK/2swC+ZZRz936x1ae82gq+9pLouteTFTGywCq/RssbFeNOz2+BsfxhHw/jbh8HJ0crPLfKCvCR7JCaH5IR8JSMyJpz8CXrBbvA8fBOOwkn4o0sNg1XNLlmLMPsLVN3NCQ==</latexit><latexit sha1_base64="3y2QarQJdBdIekQHDxXFrk+jRrU=">AAACqHicbVFda9swFJW9ry77Stu97eWyMOi+gl1WWiiDdmOwxwyWpiMyRlaUVqksC+l6NLje/9z7fshkOw9LuguSDufcq3t1lBklHUbR7yC8c/fe/QdbD3uPHj95+qy/vXPmitJyMeaFKux5xpxQUosxSlTi3FjB8kyJSXb1udEnP4V1stDfcWlEkrMLLeeSM/RU2v9FXZmnlQQqNZzWwFIPj+nxW2gP6ORFK3+qIUsXHf++1yl+zxwyflXtyXeweN0mfgFKp8P9A5EncHMKlDMDtGp0Wt/AR4jrGoxvuqjT/iAaRm3AbRCvwICsYpRuBzt0VvAyFxq5Ys5N48hgUjGLkitR92jphPHzsAsx9VCzXLikao2q4ZVnZjAvrF8aoWX/rahY7twyz3xmzvDSbWoN+T9tWuL8KKmkNiUKzbtG81IBFtC4DjNpBUe19IBxK/2swC+ZZRz936x1ae82gq+9pLouteTFTGywCq/RssbFeNOz2+BsfxhHw/jbh8HJ0crPLfKCvCR7JCaH5IR8JSMyJpz8CXrBbvA8fBOOwkn4o0sNg1XNLlmLMPsLVN3NCQ==</latexit><latexit sha1_base64="3y2QarQJdBdIekQHDxXFrk+jRrU=">AAACqHicbVFda9swFJW9ry77Stu97eWyMOi+gl1WWiiDdmOwxwyWpiMyRlaUVqksC+l6NLje/9z7fshkOw9LuguSDufcq3t1lBklHUbR7yC8c/fe/QdbD3uPHj95+qy/vXPmitJyMeaFKux5xpxQUosxSlTi3FjB8kyJSXb1udEnP4V1stDfcWlEkrMLLeeSM/RU2v9FXZmnlQQqNZzWwFIPj+nxW2gP6ORFK3+qIUsXHf++1yl+zxwyflXtyXeweN0mfgFKp8P9A5EncHMKlDMDtGp0Wt/AR4jrGoxvuqjT/iAaRm3AbRCvwICsYpRuBzt0VvAyFxq5Ys5N48hgUjGLkitR92jphPHzsAsx9VCzXLikao2q4ZVnZjAvrF8aoWX/rahY7twyz3xmzvDSbWoN+T9tWuL8KKmkNiUKzbtG81IBFtC4DjNpBUe19IBxK/2swC+ZZRz936x1ae82gq+9pLouteTFTGywCq/RssbFeNOz2+BsfxhHw/jbh8HJ0crPLfKCvCR7JCaH5IR8JSMyJpz8CXrBbvA8fBOOwkn4o0sNg1XNLlmLMPsLVN3NCQ==</latexit>

��

i�V

ai +�

j�V

bj

� ��

i�A

ai ��

j�B

bj +�

(i,j)�E

|A�{i,j}|=1

pij

<latexit sha1_base64="auxNyv6hVALgGUWIkq8vR+5g5r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7Z2TSXHMx5KlK9UXIjFAyEUOUqMRFpgWLQyXOw8uPlX7+XWgj0+QrLjMxidkskZHkDC0VdP9QJSKEPlCTx0EhgcoERiWwwMJj2Ku2RlrcSGFgoZazOcKulW3CfnOsWpzeWNDjfViVG5sPrU3F73Uaxe6hQcYvi758DYvdOvETUDoeHL4V8QSuT4FylgEtKp2W1/Ae/LKEzDZdlEG35w28OuA28FvQI22cBdvODp2mPI9FglwxY8a+l+GkYBolV6Ls0NyIzN6HzcTYwoTFwkyKeuYlvLLMFKJU25Ug1OxqRcFiY5ZxaDNjhnOzqVXk/7RxjtHRpJBJlqNIeNMoyhVgCtUHwlRqwVEtLWBcS3tX4HOmGUf7zWtdau9M8LWXFFd5Ink6FRuswivUrJqivzmz22B0OPC9gf/lTe/kqJ3nFnlBXpI+8ck7ckI+kzMyJNw5cIbONydwc/eH+9P91aS6TlvznKyF+/sfiGDmNQ==</latexit>

a constant

��

i�V

ai +�

j�V

bj

� ��

i�A

ai ��

j�B

bj +�

(i,j)�E

|A�{i,j}|=1

pij

<latexit sha1_base64="auxNyv6hVALgGUWIkq8vR+5g5rI=">AAAC83icbVHbahsxENVub6l7c9LHvgw1BYc0zm5oaSAUkpZCH1OonYDlLlpZa8vRXpBmS8xmv6Rvpa/9kH5C/6baS8B2OiDpcM7MGWkUZkoa9Ly/jnvn7r37D7Yedh49fvL0WXd7Z2TSXHMx5KlK9UXIjFAyEUOUqMRFpgWLQyXOw8uPlX7+XWgj0+QrLjMxidkskZHkDC0VdP9QJSKEPlCTx0EhgcoERiWwwMJj2Ku2RlrcSGFgoZazOcKulW3CfnOsWpzeWNDjfViVG5sPrU3F73Uaxe6hQcYvi758DYvdOvETUDoeHL4V8QSuT4FylgEtKp2W1/Ae/LKEzDZdlEG35w28OuA28FvQI22cBdvODp2mPI9FglwxY8a+l+GkYBolV6Ls0NyIzN6HzcTYwoTFwkyKeuYlvLLMFKJU25Ug1OxqRcFiY5ZxaDNjhnOzqVXk/7RxjtHRpJB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aS6TlvznKyF+/sfiGDmNQ==</latexit>

Page 58: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Image segmentation

Formulate as min-cut problem G ʹ = (V ʹ, E ʹ).

独Include node for each pixel.

独Use two antiparallel edges instead ofundirected edge.

独Add source s to correspond to foreground.

独Add sink t to correspond to background.

60

s ti j

G′

pij

pij

pij

pij

aj

bi

two antiparallel edges in G′

edge in G

Page 59: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Image segmentation

Consider min cut (A, B) in G ʹ.

独 A = foreground.

独Precisely the quantity we want to minimize.

61

s ti j

G′

A

if i and j on different sides, pij counted exactly once

cap(A, B) =�

j�B

aj +�

i�A

bi +�

(i,j)�E

i�A, j�B

pij

<latexit sha1_base64="GcrfvkZNab/Z8lQbNEchAcXUvOM=">AAACvHicbVHtatswFJW9ry77aNr9HIzLwlhKQ7DLxgplo+0Y7GcHS1uIjZHlm1aJJBtJLg3GL7G325vs5xTbgybdBUmHc+6X7k0LwY0Ngt+e/+Dho8dPtp72nj1/8XK7v7N7bvJSM5ywXOT6MqUGBVc4sdwKvCw0UpkKvEgXX1f6xQ1qw3P10y4LjCW9UnzGGbWOSvq/GC2GJyM43YPoKDqCz+0TmVIm1RwiruC0BprMG34f7sq8kU9qSBPe8vu9VnF3aixli2rIRzDfaxy/QRRNxwcfUcbQhY5cGPyrUkPhcs7rpD8IxkFjcB+EHRiQzs6SHW83ynJWSlSWCWrMNAwKG1dUW84E1r2oNFi4bugVTh1UVKKJq2Z4NbxzTAazXLujLDTs3YiKSmOWMnWektprs6mtyP9p09LODuOKq6K0qFhbaFYKsDmsNgEZ18isWDpAmeauV2DXVFNm3b7WqjS5C2RrP6luS8VZnuEGK+yt1XQ1xXBzZvfB+cE4DMbhjw+D48NunlvkNXl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1dUW84E1r2oNFi4bugVTh1UVKKJq2Z4NbxzTAazXLujLDTs3YiKSmOWMnWektprs6mtyP9p09LODuOKq6K0qFhbaFYKsDmsNgEZ18isWDpAmeauV2DXVFNm3b7WqjS5C2RrP6luS8VZnuEGK+yt1XQ1xXBzZvfB+cE4DMbhjw+D48NunlvkNXlLhiQkn8gx+U7OyIQw8sd74733hv4XP/MXvmxdfa+LeUXWzL/5CybL0fU=</latexit><latexit sha1_base64="GcrfvkZNab/Z8lQbNEchAcXUvOM=">AAACvHicbVHtatswFJW9ry77aNr9HIzLwlhKQ7DLxgplo+0Y7GcHS1uIjZHlm1aJJBtJLg3GL7G325vs5xTbgybdBUmHc+6X7k0LwY0Ngt+e/+Dho8dPtp72nj1/8XK7v7N7bvJSM5ywXOT6MqUGBVc4sdwKvCw0UpkKvEgXX1f6xQ1qw3P10y4LjCW9UnzGGbWOSvq/GC2GJyM43YPoKDqCz+0TmVIm1RwiruC0BprMG34f7sq8kU9qSBPe8vu9VnF3aixli2rIRzDfaxy/QRRNxwcfUcbQhY5cGPyrUkPhcs7rpD8IxkFjcB+EHRiQzs6SHW83ynJWSlSWCWrMNAwKG1dUW84E1r2oNFi4bugVTh1UVKKJq2Z4NbxzTAazXLujLDTs3YiKSmOWMnWektprs6mtyP9p09LODuOKq6K0qFhbaFYKsDmsNgEZ18isWDpAmeauV2DXVFNm3b7WqjS5C2RrP6luS8VZnuEGK+yt1XQ1xXBzZvfB+cE4DMbhjw+D48NunlvkNXlLhiQkn8gx+U7OyIQw8sd74733hv4XP/MXvmxdfa+LeUXWzL/5CybL0fU=</latexit>

pij

aj

bi

Page 60: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Grabcut. [ Rother–Kolmogorov–Blake 2004 ]

Grabcut image segmentation

62

“GrabCut” — Interactive Foreground Extraction using Iterated Graph Cuts

Carsten Rother∗ Vladimir Kolmogorov†Microsoft Research Cambridge, UK

Andrew Blake‡

Figure 1: Three examples of GrabCut . The user drags a rectangle loosely around an object. The object is then extracted automatically.

Abstract

The problem of efficient, interactive foreground/background seg-mentation in still images is of great practical importance in im-age editing. Classical image segmentation tools use either texture(colour) information, e.g. Magic Wand, or edge (contrast) infor-mation, e.g. Intelligent Scissors. Recently, an approach based onoptimization by graph-cut has been developed which successfullycombines both types of information. In this paper we extend thegraph-cut approach in three respects. First, we have developed amore powerful, iterative version of the optimisation. Secondly, thepower of the iterative algorithm is used to simplify substantially theuser interaction needed for a given quality of result. Thirdly, a ro-bust algorithm for “border matting” has been developed to estimatesimultaneously the alpha-matte around an object boundary and thecolours of foreground pixels. We show that for moderately difficultexamples the proposed method outperforms competitive tools.

CR Categories: I.3.3 [Computer Graphics]: Picture/ImageGeneration—Display algorithms; I.3.6 [Computer Graphics]:Methodology and Techniques—Interaction techniques; I.4.6 [Im-age Processing and Computer Vision]: Segmentation—Pixel clas-sification; partitioning

Keywords: Interactive Image Segmentation, Graph Cuts, ImageEditing, Foreground extraction, Alpha Matting

1 Introduction

This paper addresses the problem of efficient, interactive extrac-tion of a foreground object in a complex environment whose back-ground cannot be trivially subtracted. The resulting foreground ob-ject is an alpha-matte which reflects the proportion of foregroundand background. The aim is to achieve high performance at thecost of only modest interactive effort on the part of the user. Highperformance in this task includes: accurate segmentation of objectfrom background; subjectively convincing alpha values, in responseto blur, mixed pixels and transparency; clean foreground colour,

∗e-mail: [email protected]†e-mail: [email protected]‡e-mail: [email protected]

free of colour bleeding from the source background. In general,degrees of interactive effort range from editing individual pixels, atthe labour-intensive extreme, to merely touching foreground and/orbackground in a few locations.

1.1 Previous approaches to interactive matting

In the following we describe briefly and compare several state ofthe art interactive tools for segmentation: Magic Wand, IntelligentScissors, Graph Cut and Level Sets and for matting: Bayes Mattingand Knockout. Fig. 2 shows their results on a matting task, togetherwith degree of user interaction required to achieve those results.

Magic Wand starts with a user-specified point or region to com-pute a region of connected pixels such that all the selected pixelsfall within some adjustable tolerance of the colour statistics of thespecified region. While the user interface is straightforward, findingthe correct tolerance level is often cumbersome and sometimes im-possible. Fig. 2a shows the result using Magic Wand from AdobePhotoshop 7 [Adobe Systems Incorp. 2002]. Because the distri-bution in colour space of foreground and background pixels have aconsiderable overlap, a satisfactory segmentation is not achieved.

Intelligent Scissors (a.k.a. Live Wire or Magnetic Lasso)[Mortensen and Barrett 1995] allows a user to choose a “minimumcost contour” by roughly tracing the object’s boundary with themouse. As the mouse moves, the minimum cost path from the cur-sor position back to the last “seed” point is shown. If the computedpath deviates from the desired one, additional user-specified “seed”points are necessary. In fig. 2b the Magnetic Lasso of Photoshop 7was used. The main limitation of this tool is apparent: for highlytexture (or un-textured) regions many alternative “minimal” pathsexist. Therefore many user interactions (here 19) were necessary toobtain a satisfactory result. Snakes or Active Contours are a relatedapproach for automatic refinement of a lasso [Kass et al. 1987].

Bayes matting models colour distributions probabilistically toachieve full alpha mattes [Chuang et al. 2001] which is based on[Ruzon and Tomasi 2000]. The user specifies a “trimap” T ={TB,TU ,TF} in which background and foreground regions TB andTF are marked, and alpha values are computed over the remain-ing region TU . High quality mattes can often be obtained (fig.2c), but only when the TU region is not too large and the back-ground/foreground colour distributions are sufficiently well sepa-rated. A considerable degree of user interaction is required to con-struct an internal and an external path.

Knockout 2 [Corel Corporation 2002] is a proprietary plug-in forPhotoshop which is driven from a user-defined trimap, like Bayesmatting, and its results are sometimes similar (fig. 2d), sometimesof less quality according to [Chuang et al. 2001].

Page 61: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

7. NETWORK FLOW II

‣ bipartite matching

‣ disjoint paths

‣ extensions to max flow

‣ survey design

‣ airline scheduling

‣ image segmentation

‣ project selection

‣ baseball eliminationSECTION 7.11

Page 62: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Project selection (maximum weight closure problem)

Projects with prerequisites.

独Set of possible projects P : project v has associated revenue pv.

独Set of prerequisites E : (v, w) ∈ E means w is a prerequisite for v.

独A subset of projects A ⊆ P is feasible if the prerequisite of every project

in A also belongs to A.

Project selection problem. Given a set of projects P and prerequisites E,

choose a feasible subset of projects to maximize revenue.

64

can be positive or negative

MANAGEMENT SCIENCE Vol. 22, No. 1 1, July, 1976

Printed in U.SA.

MAXIMAL CLOSURE OF A GRAPH AND APPLICATIONS TO COMBINATORIAL

PROBLEMS*t

JEAN-CLAUDE PICARD

Ecole Polytechnique, Montreal

This paper generalizes the selection problem discussed by J. M. Rhys [12], J. D. Murchland [9], M. L. Balinski [1] and P. Hansen [4]. Given a directed graph G, a closure of G is defined as a subset of nodes such that if a node belongs to the closure all its successors also belong to the set. If a real number is associated to each node of G a maximal closure is defined as a closure of maximal value.

1. Introduction

The selection problem discussed by J. M. Rhys [12] and M. L. Balinksi [1] can be defined as follows: A finite set of points S ("stations") together with the "cost" c, > 0 of choosing ("constructing") any point s of S is given. At the same time, a finite collection I of subsets a of points from S is specified together with the "profit" pa of choosing any one of the subsets a. Define a selection to be a collection of subsets from E together with all points of S which belong to this collection. Let the value of the selection be the sum of the profits of the subsets from E minus the sum of the costs of the points of S in the selection. The problem is to find a selection of maximum value. J. M. Rhys [12] and M. L. Balinski [1] have shown that this problem can be solved as a maximal flow problem in a bipartite graph.

This selection problem can easily be generalized as follows: Given a directed graph G = (V, A) where V is the set of nodes and A the set of arcs, a closure of G is defined as a subset of vertices Y such that if a vertex belongs to Y then all its successors belong also to Y. If to each vertex vi is associated a real number, mi, then a maximal closure Y* of G is defined as a closure of maximal value (i.e. Ev E y.mi is maximal).

In this paper, it is shown that the problem of finding a maximal closure of a graph is equivalent to solving the maximal flow problem in a network formed by the graph G with infinite capacities on its arcs, a source linked to each node vi of positive value by an arc of capacity (+ mi) and a sink linked from each node vi of negative value by an arc of capacity (- mi).

The selection problem is then the maximal closure problem in a bipartite graph G = (E, S, A) with arcs A = {(u, s) a E E, s E S, and s E a), and where the value associated with each node a EE is pa and the value associated with each node s E S is - Cs.

Applications J. M. Rhys [12] and J. D. Murchland [9] give several applications of the selection

problem. The maximal closure of a graph finds its main application in mining engineering for determining optimum pit mine contours [5]-[8]. Given an ore body decomposed into blocks, there is a net value (the profit of the block minus the operating, capital and fixed costs) associated with each block. Determining optimum

* Processed by Professor Morton Klein, Departmental Editor for Network Flows and Location Analysis and Associate Editor Michael Held; received June 11, 1975, revised August 28, 1975. This paper has been with the author 2 months for revision.

t This research was supported by a grant from the Iron Ore Company of Canada. 1268

Copyright ?) 1976, The Institute of Management Sciences

This content downloaded from 140.180.240.185 on Mon, 1 Apr 2013 10:50:35 AMAll use subject to JSTOR Terms and Conditions

Page 63: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Project selection: prerequisite graph

Prerequisite graph. Add edge (v, w) if w is a prerequisite for v.

65

{ v, w, x } is feasible

w

v x

{ v, x } is infeasible

v

w

x

Page 64: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Project selection: min-cut formulation

Min-cut formulation.

独Assign a capacity of ∞ to each prerequisite edge.

独Add edge (s, v) with capacity pv if pv > 0.

独Add edge (v, t) with capacity −pv if pv < 0.

独For notational convenience, define ps = pt = 0.

−pw

66

pv −px

py

pu

−pz

∞∞

∞∞

s y

u w

z

x

t

v

Page 65: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Claim. (A, B) is min cut iff A − { s } is an optimal set of projects.

独Infinite capacity edges ensure A − { s } is feasible.

独Max revenue because:

Project selection: min-cut formulation

67

−pw

∞∞

∞∞

∞py

pu ∞

A

−pz

−px

cap(A, B) =�

v�B : pv>0

pv +�

v�A : pv<0

(�pv)

<latexit sha1_base64="J7ovUG3O0B6JAPb1uEZLcgPlwAo=">AAACj3icbVFNTxsxEHUW2tL0K6FHLiOiSkFto92qEkh8KNBLuVGpAaRstPI6E7Dwei17NiJa5RfyC/ozei2XepccSGAky09v3vjZz6lR0lEY/mkEa+svXr7aeN188/bd+w+t9ua5ywsrcCByldvLlDtUUuOAJCm8NBZ5liq8SG9+VP2LKVonc/2bZgZHGb/SciIFJ08lLRTcdI+/wMkOxPvxPhzWWzN2RZaUU4ilhhOIKx8NJpnCEYRzqFEt/wxL0uPH0oNK2v3q4U7S6oS9sC54CqIF6LBFnSXtxmY8zkWRoSahuHPDKDQ0KrklKRTOm3Hh0HBxw69w6KHmGbpRWecxh0+eGcMkt35pgpp9PFHyzLlZlnplxunarfYq8rnesKDJ3qiU2hSEWjwYTQoFlEMVLoylRUFq5gEXVvq7grjmlgvyX7DkUp9tUCy9pLwttBT5GFdYRbdk+dynGK1m9hScf+tFYS/69b3T31vkucG22Dbrsojtsj77yc7YgAl2x/6yf+w+aAe7wVHQf5AGjcXMR7ZUwel/USnEfg==</latexit><latexit sha1_base64="J7ovUG3O0B6JAPb1uEZLcgPlwAo=">AAACj3icbVFNTxsxEHUW2tL0K6FHLiOiSkFto92qEkh8KNBLuVGpAaRstPI6E7Dwei17NiJa5RfyC/ozei2XepccSGAky09v3vjZz6lR0lEY/mkEa+svXr7aeN188/bd+w+t9ua5ywsrcCByldvLlDtUUuOAJCm8NBZ5liq8SG9+VP2LKVonc/2bZgZHGb/SciIFJ08lLRTcdI+/wMkOxPvxPhzWWzN2RZaUU4ilhhOIKx8NJpnCEYRzqFEt/wxL0uPH0oNK2v3q4U7S6oS9sC54CqIF6LBFnSXtxmY8zkWRoSahuHPDKDQ0KrklKRTOm3Hh0HBxw69w6KHmGbpRWecxh0+eGcMkt35pgpp9PFHyzLlZlnplxunarfYq8rnesKDJ3qiU2hSEWjwYTQoFlEMVLoylRUFq5gEXVvq7grjmlgvyX7DkUp9tUCy9pLwttBT5GFdYRbdk+dynGK1m9hScf+tFYS/69b3T31vkucG22Dbrsojtsj77yc7YgAl2x/6yf+w+aAe7wVHQf5AGjcXMR7ZUwel/USnEfg==</latexit><latexit sha1_base64="J7ovUG3O0B6JAPb1uEZLcgPlwAo=">AAACj3icbVFNTxsxEHUW2tL0K6FHLiOiSkFto92qEkh8KNBLuVGpAaRstPI6E7Dwei17NiJa5RfyC/ozei2XepccSGAky09v3vjZz6lR0lEY/mkEa+svXr7aeN188/bd+w+t9ua5ywsrcCByldvLlDtUUuOAJCm8NBZ5liq8SG9+VP2LKVonc/2bZgZHGb/SciIFJ08lLRTcdI+/wMkOxPvxPhzWWzN2RZaUU4ilhhOIKx8NJpnCEYRzqFEt/wxL0uPH0oNK2v3q4U7S6oS9sC54CqIF6LBFnSXtxmY8zkWRoSahuHPDKDQ0KrklKRTOm3Hh0HBxw69w6KHmGbpRWecxh0+eGcMkt35pgpp9PFHyzLlZlnplxunarfYq8rnesKDJ3qiU2hSEWjwYTQoFlEMVLoylRUFq5gEXVvq7grjmlgvyX7DkUp9tUCy9pLwttBT5GFdYRbdk+dynGK1m9hScf+tFYS/69b3T31vkucG22Dbrsojtsj77yc7YgAl2x/6yf+w+aAe7wVHQf5AGjcXMR7ZUwel/USnEfg==</latexit><latexit sha1_base64="J7ovUG3O0B6JAPb1uEZLcgPlwAo=">AAACj3icbVFNTxsxEHUW2tL0K6FHLiOiSkFto92qEkh8KNBLuVGpAaRstPI6E7Dwei17NiJa5RfyC/ozei2XepccSGAky09v3vjZz6lR0lEY/mkEa+svXr7aeN188/bd+w+t9ua5ywsrcCByldvLlDtUUuOAJCm8NBZ5liq8SG9+VP2LKVonc/2bZgZHGb/SciIFJ08lLRTcdI+/wMkOxPvxPhzWWzN2RZaUU4ilhhOIKx8NJpnCEYRzqFEt/wxL0uPH0oNK2v3q4U7S6oS9sC54CqIF6LBFnSXtxmY8zkWRoSahuHPDKDQ0KrklKRTOm3Hh0HBxw69w6KHmGbpRWecxh0+eGcMkt35pgpp9PFHyzLlZlnplxunarfYq8rnesKDJ3qiU2hSEWjwYTQoFlEMVLoylRUFq5gEXVvq7grjmlgvyX7DkUp9tUCy9pLwttBT5GFdYRbdk+dynGK1m9hScf+tFYS/69b3T31vkucG22Dbrsojtsj77yc7YgAl2x/6yf+w+aAe7wVHQf5AGjcXMR7ZUwel/USnEfg==</latexit>

=�

v : pv>0

pv ��

v�A

pv

<latexit sha1_base64="H0rDhkRDWFu2VWoEpLP+ycWevVU=">AAACb3icbVDRShtBFJ2stWqqNepDHwpyaSi0D4ZdERREUYrQR4VGhWxYZic3ZnB2dpm5GwzLfpFf46P6Ff6Bs2ugTeyFYQ7nnHvvzIkzJS35/mPDW/iw+HFpeaX5aXXt83prY/PSprkR2BWpSs11zC0qqbFLkhReZwZ5Eiu8im9/VfrVGI2Vqf5Dkwz7Cb/RcigFJ0dFrTMID8NDOKqvZmjzJCrGEFaDNWTRGI7BL6FGtXEH/pqkhlMoKy1qtf2OXxe8B8EUtNm0zqONxmY4SEWeoCahuLW9wM+oX3BDUigsm2FuMePilt9gz0HNE7T9ov5vCd8dM4BhatzRBDX7b0fBE2snSeycCaeRndcq8n9aL6fhQb+QOssJtXhbNMwVUApVeDCQBgWpiQNcGOneCmLEDRfkIp7ZUs/OUMz8pLjLtRTpAOdYRXdkeOlSDOYzew8udzuB3wku9tonB9M8l9lX9o39YAHbZyfsNztnXSbYPXtgT+y58eJ98bY9eLN6jWnPFpsp7+crqIm7MA==</latexit><latexit sha1_base64="H0rDhkRDWFu2VWoEpLP+ycWevVU=">AAACb3icbVDRShtBFJ2stWqqNepDHwpyaSi0D4ZdERREUYrQR4VGhWxYZic3ZnB2dpm5GwzLfpFf46P6Ff6Bs2ugTeyFYQ7nnHvvzIkzJS35/mPDW/iw+HFpeaX5aXXt83prY/PSprkR2BWpSs11zC0qqbFLkhReZwZ5Eiu8im9/VfrVGI2Vqf5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S35/mPDW/iw+HFpeaX5aXXt83prY/PSprkR2BWpSs11zC0qqbFLkhReZwZ5Eiu8im9/VfrVGI2Vqf5Dkwz7Cb/RcigFJ0dFrTMID8NDOKqvZmjzJCrGEFaDNWTRGI7BL6FGtXEH/pqkhlMoKy1qtf2OXxe8B8EUtNm0zqONxmY4SEWeoCahuLW9wM+oX3BDUigsm2FuMePilt9gz0HNE7T9ov5vCd8dM4BhatzRBDX7b0fBE2snSeycCaeRndcq8n9aL6fhQb+QOssJtXhbNMwVUApVeDCQBgWpiQNcGOneCmLEDRfkIp7ZUs/OUMz8pLjLtRTpAOdYRXdkeOlSDOYzew8udzuB3wku9tonB9M8l9lX9o39YAHbZyfsNztnXSbYPXtgT+y58eJ98bY9eLN6jWnPFpsp7+crqIm7MA==</latexit>a constant

uw

s

v x

y z t

pv

minimizing this is equivalent to maximizing revenue

Page 66: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Open-pit mining

Open-pit mining. [studied since early 1960s]

独Blocks of earth are extracted from surface to retrieve ore.

独Each block v has net value pv = value of ore – processing cost.

独Can’t remove block v until both blocks w and x are removed.

68

v xw

Page 67: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

7. NETWORK FLOW II

‣ bipartite matching

‣ disjoint paths

‣ extensions to max flow

‣ survey design

‣ airline scheduling

‣ image segmentation

‣ project selection

‣ baseball eliminationSECTION 7.12

Page 68: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Baseball elimination

70

Page 69: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Baseball elimination problem

Q. Which teams have a chance of finishing the season with the most wins?

Montreal is mathematically eliminated.

独Montreal finishes with ≤ 80 wins.

独Atlanta already has 83 wins.

Remark. This is the only reason sports writers appear to be aware of —

conditions are sufficient but not necessary!

71

i team wins losses to play ATL PHI NYM MON

0 Atlanta 83 71 8 – 1 6 1

1 Philly 80 79 3 1 – 0 2

2 New York 78 78 6 6 0 – 0

3 Montreal 77 82 3 1 2 0 –

Page 70: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Baseball elimination problem

Q. Which teams have a chance of finishing the season with the most wins?

Philadelphia is mathematically eliminated.

独Philadelphia finishes with ≤ 83 wins.

独Either New York or Atlanta will finish with ≥ 84 wins.

Observation. Answer depends not only on how many games already won

and left to play, but on whom they’re against.

72

i team wins losses to play ATL PHI NYM MON

0 Atlanta 83 71 8 – 1 6 1

1 Philly 80 79 3 1 – 0 2

2 New York 78 78 6 6 0 – 0

3 Montreal 77 82 3 1 2 0 –

Page 71: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Baseball elimination problem

Current standings.

独Set of teams S.

独Distinguished team z ∈ S.

独Team x has won wx games already.

独Teams x and y play each other rxy additional times.

Baseball elimination problem. Given the current standings, is there any

outcome of the remaining games in which team z finishes with the most (or tied for the most) wins?

73

SIAM REVIEWVol. 8, No. 3, July, 1966

POSSIBLE WINNERS IN PARTIALLY COMPLETED TOURNAMENTS*

BENJAMIN L. SCHWARTZ

1. Introduction. In this paper, we shall investigate certain questions in tourna-ment scheduling. For definiteness, we shall use the terminology of baseball. Weshall be concerned with the categorization of teams into three classes duringthe closing days of the season. A team may be definitely eliminated from pen-nant possibility; it may be in contention, or it may have clinched the champion-ship. It will be our convention that a team that can possibly tie for the pennantis considered still in contention. In this paper necessary and sufficient conditionsare developed to classify any team properly into the appropriate category.

2. First example. We consider first an extremely simple example, but onethat will prove instructive. Suppose one team, say the New York Mets, findsitself at one point in the season 37 games behind another, perhaps the Dodgers,with 36 to play for each team. Then we can surely declare that the Mets areeliminated.At the risk of belaboring the obvious, we propose to examine in detail why

this is so. A natural unit for accounting for team changes in position is half-games behind (henceforth HGB).The Mets are trailing the Dodgers by 74 HGB (= 37 games). What hope do

they have to overcome this deficit? Each game they have still to play offersthem potentially the prospect of one HGB gain, since they may wb it. Thereare 36 such games. Likewise, each game the Dodgers still have to play gives theMets the prospect of one HGB gain, since the Dodgers may lose. There arealso 36 of these. The total maximum potential gain is only 36 + 36 72 HGB,not enough to overcome the existing debit balance. Hence the Mets are indeedeliminated by the Dodgers.The generalized rule that has been illustrated here can easily be formalized.

Let team x be N HGB behind team y. Let the number of games still to play forx and y be P(x) and P(y), respectively. Then, if

(1) N- P(x) P(y) > O,we can assert that x is eliminated by y.

In fact, this criterion merely gives a condition for the possible interchange ofx and y in the standings before season’s end. A team has the pennant clinchedwhen it is leading the league, and no other team can interchange with it.

3. Example of general situation. Let us now look at a more interesting situa-tion. Table 1 gives standings in a fictitious league, part way through the season.

* Received by the editors June 1, 1965, and in final revised form December 1, 1965.United States Navy Postgraduate School, Monterey, California. Now at Weapons

Systems Evaluation Division, Institute for Defense Analyses, Arlington, Virginia.This table is adaped from the actual standings in the National League in mid-Sep-

tember 1963.

302

Dow

nloa

ded

04/0

1/13

to 1

40.1

80.2

40.1

85. R

edis

tribu

tion

subj

ect t

o SI

AM

lice

nse

or c

opyr

ight

; see

http

://w

ww

.siam

.org

/jour

nals

/ojs

a.ph

p

Page 72: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Baseball elimination problem: max-flow formulation

Can team 4 finish with most wins?

独Assume team 4 wins all remaining games ⇒ w4 + r4 wins.

独Divvy remaining games so that all teams have ≤ w4 + r4 wins.

74

s g12 t

game nodes(each pair of teams other than 4)

team nodes(each team other than 4)

w4 + r4 – w2

1

0

3

2

0–2

0–3

1–3

0–1

2–3

1–2

games left between 1 and 2

team 2 can still win this many more games

Page 73: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Baseball elimination problem: max-flow formulation

Theorem. Team 4 not eliminated iff max flow saturates all edges leaving s. Pf.

独Integrality theorem ⇒ each remaining game between x and y added to

number of wins for team x or team y.

独Capacity on (x, t) edges ensure no team wins too many games. ▪

75

s t

game nodes(each pair of teams other than 4)

team nodes(each team other than 4)

1

0

3

2

0–2

0–3

1–3

0–1

2–3

1–2

games left between 1 and 2

g12 w4 + r4 – w2

team 2 can still win this many more games

Page 74: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Baseball elimination: explanation for sports writers

Q. Which teams have a chance of finishing the season with the most wins?

Detroit is mathematically eliminated.

独Detroit finishes with ≤ 76 wins.

独Wins for R = { NYY, BAL, BOS, TOR } = 278.

独Remaining games among { NYY, BAL, BOS, TOR } = 3 + 8 + 7 + 2 + 7 = 27.

独Average team in R wins 305/4 = 76.25 games.

76

i team wins losses to play NYY BAL BOS TOR DET

0 New York 75 59 28 – 3 8 7 3

1 Baltimore 71 63 28 3 – 2 7 4

2 Boston 69 66 27 8 2 – 0 0

3 Toronto 63 72 27 7 7 0 – 0

4 Detroit 49 86 27 3 4 0 0 –

AL East (August 30, 1996)

Page 75: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Baseball elimination: explanation for sports writers

Certificate of elimination.

Theorem. [Hoffman–Rivlin 1967] Team z is eliminated iff there exists a

subset T* such that

Pf. ⇐

独Suppose there exists T* ⊆ S such that .

独Then, the teams in T* win at least (w(T*) + g(T*)) / | T* | games on average.

独This exceeds the maximum number that team z can win. ▪

77

T ⊆ S, w(T ) := wii∈T∑# wins! " #

, g(T ) := gx y{x,y} ⊆ T

# remaining games! " $ $ # $ $ ,

wz + gz <w(T*)+ g(T*)

|T* |

wz + gz <w(T*)+ g(T*)

|T* |

Page 76: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Baseball elimination: explanation for sports writers

Pf. ⇒

独Use max-flow formulation, and consider min cut (A, B).

独Let T* = team nodes on source side A of min cut.

独Observe that game node x–y ∈ A iff both x ∈ T* and y ∈ T*. - infinite capacity edges ensure if x–y ∈ A, then both x ∈ A and y ∈ A - if x ∈ A and y ∈ A but x–y ∉ A, then adding x–y to A decreases the

capacity of the cut by gxy

s

y

x t

78

x–ygxy

∞ wz + rz – wx

y

x

Page 77: 7. NETWORK FLOW II - Princeton University Computer …wayne/kleinberg-tardos/pdf/07NetworkFlowII.… · Perfect matching in a bipartite graph Def. Given a graph G = (V, E) a subset

Baseball elimination: explanation for sports writers

Pf. ⇒

独Use max-flow formulation, and consider min cut (A, B).

独Let T* = team nodes on source side A of min cut.

独Observe that game node x–y ∈ A iff both x ∈ T* and y ∈ T*.

独Since team z is eliminated, by max-flow min-cut theorem,

独Rearranging terms: ▪

79

g(S − {z}) > cap(A, B)

= g(S − {z})− g(T*)capacity of game edges leaving s! " # # # $ # # #

+ (wz + gz −wx )x∈T*∑

capacity of team edges leaving s! " # # # $ # # #

= g(S − {z})− g(T*) − w(T*) + |T* | (wz + gz )

wz + gz <w(T*)+ g(T*)

|T* |

g(S − {z}) > cap(A, B)

= g(S − {z})− g(T*)capacity of game edges leaving s! " # # # $ # # #

+ (wz + gz −wx )x∈T*∑

capacity of team edges leaving s! " # # # $ # # #

= g(S − {z})− g(T*) − w(T*) + |T* | (wz + gz )

g(S − {z}) > cap(A, B)

= g(S − {z})− g(T*)capacity of game edges leaving s! " # # # $ # # #

+ (wz + gz −wx )x∈T*∑

capacity of team edges leaving s! " # # # $ # # #

= g(S − {z})− g(T*) − w(T*) + |T* | (wz + gz )

capacity of team edges entering tcapacity of game edges leaving s