









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










3 Matching. ļ® Input: undirected graph G = (V, E). ļ® M ā E is a matching if each node appears in at most edge in M. ļ® Max matching: find a max cardinality matching.
4
Bipartite matching. ļ® Input: undirected, bipartite graph G = (L āŖ R, E). ļ® M ā E is a matching if each node appears in at most edge in M. ļ® Max matching: find a max cardinality matching. 1 3 5 1' 3' 5' 2 4 2' 4' matching 1-2', 3-1', 4-5' L R
5
Bipartite matching. ļ® Input: undirected, bipartite graph G = (L āŖ R, E). ļ® M ā E is a matching if each node appears in at most edge in M. ļ® Max matching: find a max cardinality matching. 1 3 5 1' 3' 5' 2 4 2' 4' L R max matching 1-1', 2-2', 3-3' 4-4' 6 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 source s, and unit capacity edges from s to each node in L. ļ® Add sink t, and unit capacity edges from each node in R to t.
s 1 3 5 1' 3' 5' t 2 4 2' 4' 1 1 ā L R G' 7 Theorem. Max cardinality matching in G = value of max flow in G'. Pf. ā¤ ļ® Given max matching M of cardinality k. ļ® Consider flow f that sends 1 unit along each of k paths. ļ® f is a flow, and has cardinality k. āŖ
s 1 3 5 1' 3' 5' t 2 4 2' 4' 1 1 1 ā 3 5 1' 3' 5' 2 4 2' 4' G G' 8 Theorem. Max cardinality matching in G = value of max flow in G'. Pf. ā„ ļ® Let f be a max flow in G' of value k. ļ® 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.
1 3 5 1' 3' 5' 2 4 2' 4' G s 1 3 5 1' 3' 5' t 2 4 2' 4' 1 1 ā G'
13 Which max flow algorithm to use for bipartite matching? ļ® Generic augmenting path: O(m val(f*) ) = O(mn). ļ® Capacity scaling: O(m^2 log C ) = O(m^2 ). ļ® Shortest augmenting path: O(m n1/2). Non-bipartite matching. ļ® Structure of non-bipartite graphs is more complicated, but well-understood. [Tutte-Berge, Edmonds-Galai] ļ® Blossom algorithm: O(n^4 ). [Edmonds 1965] ļ® Best known: O(m n1/2). [Micali-Vazirani 1980]
15 Disjoint path problem. Given a digraph G = (V, E) and two nodes s and t, find the max number of edge-disjoint s-t paths. Def. Two paths are edge-disjoint if they have no edge in common. Ex: communication networks. s 2 3 4
5 6 7 t 16 Disjoint path problem. Given a digraph G = (V, E) and two nodes s and t, find the max number of edge-disjoint s-t paths. Def. Two paths are edge-disjoint if they have no edge in common. Ex: communication networks. s 2 3 4
5 6 7 t
17 Max flow formulation: assign unit capacity to every edge. Theorem. Max number edge-disjoint s-t paths equals max flow value. Pf. ā¤ ļ® Suppose there are k edge-disjoint paths P 1 ,... , Pk. ļ® Set f(e) = 1 if e participates in some path Pi ; else set f(e) = 0. ļ® Since paths are edge-disjoint, f is a flow of value k. āŖ
s t 1 1 1 1 1 1 1 1 1 1 1 1 1 1 18 Max flow formulation: assign unit capacity to every edge. Theorem. Max number edge-disjoint s-t paths equals max flow value. 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.
s t 1 1 1 1 1 1 1 1 1 1 1 1 1 1 can eliminate cycles to get simple paths if desired 19 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. Def. A set of edges F ā E disconnects t from s if every s-t path uses at least one edge in F.
s 2 3 4 5 6 7 t 20
Theorem. [Menger 1927] The max number of edge-disjoint s-t paths is equal to 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 at most k. āŖ s 2 3 4 5 6 7 t s 2 3 4 5 6 7 t
25
Max flow formulation. G: supply 3 (^10 )
9 10 0 7 4 7 4 demand 26
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. G': supply 3 10 6 9 0 7 4 7 4 s t 10 11 (^7 8 ) saturates all edges leaving s and entering t demand 27
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 and integrality theorem for max flow. Characterization. Given (V, E, c, d), there does not exists a circulation iff there exists a node partition (A, B) such that Ī£vāB dv > cap(A, B) Pf idea. Look at min cut in G'. demand by nodes in B exceeds supply of nodes in B plus max capacity of edges going from A to B 28
Feasible circulation. ļ® Directed graph G = (V, E). ļ® Edge capacities c(e) and lower bounds l (e), e ā E. ļ® Node supply and demands d(v), v ā V. Def. A circulation is a function that satisfies: ļ® For each e ā E: l (e) ⤠f(e) ⤠c(e) (capacity) ļ® For each v ā V: (conservation) Circulation problem with lower bounds. Given (V, E, l, c, d), does there exists a a circulation?
f ( e ) e in to v " #^ f^ ( e ) e out of v " =^ d^ ( v )
29
Idea. Model lower bounds with demands. ļ® Send l(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'. If all demands, capacities, and lower bounds in G are integers, then there is a circulation in G that is integer-valued. Pf sketch. f(e) is a circulation in G iff f'(e) = f(e) - l(e) is a circulation in G'. v [2, 9] w lower bound upper bound v w d(v) d(w) (^) d(v) + 2 d(w) - 2 G (^) G' 7 capacity
31
Survey design. ļ® Design survey asking n 1 consumers about n 2 products. ļ® Can only survey consumer i about product j 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' = pi = pi' = 1. one survey question per product 32
Algorithm. Formulate as a circulation problem with lower bounds. ļ® Include an edge (i, j) if consumer j owns product i. ļ® Integer circulation ā feasible survey design. s 1 3 5 1' 3' 5' t 2 4 2' 4' [c 1 , c 1 '] [0, 1] consumers [p 1 , p 1 '] [0, ā] products
37
Formulate as min cut problem. ļ® G' = (V', E'). ļ® Add source to correspond to foreground; add sink to correspond to background ļ® Use two anti-parallel edges instead of undirected edge. s t pij pij pij i pij j aj G' bi 38
Consider min cut (A, B) in G'. ļ® A = foreground. ļ® Precisely the quantity we want to minimize. ! cap ( A , B ) = a (^) j + j " B
i " A
( i , j ) " E i " A , j " B
s i^ j t A if i and j on different sides, pij counted exactly once pij bi aj
40
Projects with prerequisites. ļ® Set P of possible projects. Project v has associated revenue pv.
41
Prerequisite graph. ļ® Include an edge from v to w if can't do v without also doing w. ļ® {v, w, x} is feasible subset of projects. ļ® {v, x} is infeasible subset of projects. v w v^ x w x feasible infeasible 42 Min cut formulation. ļ® Assign capacity ā to all 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. s t -pw u v w x y z
pv -px
pu -pz
43 Claim. (A, B) is min cut iff A ā { s } is optimal set of projects. ļ® Infinite capacity edges ensure A ā { s } is feasible. ļ® Max revenue because: s t -pw u v w x y z
pv - px
cap ( A , B ) = p (^) v v " B : pv > 0
v " A : pv < 0
= p (^) v v : pv > 0
constant
$ p (^) v v " A
py pu
A 44 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 before w or x.
v w x
49
Baseball elimination problem. ļ® Set of teams S. ļ® Distinguished team s ā S. ļ® Team x has won wx games already. ļ® Teams x and y play each other rxy additional times. ļ® Is there any outcome of the remaining games in which team s finishes with the most (or tied for the most) wins? 50 Can team 3 finish with most wins? ļ® Assume team 3 wins all remaining games ā w 3 + r 3 wins. ļ® Divvy remaining games so that all teams have ⤠w 3 + r 3 wins.
s 1- 2- 4- 2 4 5 t 1- 1- 2- 1 r 24 = 7 ā^ w 3 + r 3 - w 4 team 4 can still win this many games left^ more games ā game nodes (^) team nodes 51 Theorem. Team 3 is not eliminated iff max flow saturates all edges leaving source. ļ® 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.
s 1- 2- 4- 2 4 5 t 1- 1- 2- 1 ā team 4 can still win this many games left^ more games ā game nodes team nodes r 24 = 7 w 3 + r 3 - w 4 52
Which teams have a chance of finishing the season with most wins? ļ® Detroit could finish season with 49 + 27 = 76 wins. Team i Wins^ Against =^ rij wi To play ri Losses li NY Bal Bos Tor Toronto 63 72 27 7 7 0 - Boston 69 66 27 8 2 - 0 Baltimore 71 63 28 3 - 2 7 NY 75 59 28 - 3 8 7 Detroit 49 86 27 3 4 0 0 Det
0 4 3
AL East: August 30, 1996
53
Which teams have a chance of finishing the season with most wins? ļ® Detroit could finish season with 49 + 27 = 76 wins. Certificate of elimination. R = {NY, Bal, Bos, Tor} ļ® Have already won w(R) = 278 games. ļ® Must win at least r(R) = 27 more. ļ® Average team in R wins at least 305/4 > 76 games. Team i Wins^ Against =^ rij wi To play ri Losses li NY Bal Bos Tor Toronto 63 72 27 7 7 0 - Boston 69 66 27 8 2 - 0 Baltimore 71 63 28 3 - 2 7 NY 75 59 28 - 3 8 7 Detroit 49 86 27 3 4 0 0 Det
0 4 3
AL East: August 30, 1996 54
Certificate of elimination. If then z is eliminated (by subset T). Theorem. [Hoffman-Rivlin 1967] Team z is eliminated iff there exists a subset T* that eliminates z. Proof idea. Let T* = team nodes on source side of min cut.
T " S , w ( T ) := wi i # T
6 #^7 wins 8 , g ( T ) := gx y { x , y } " T
, ! w ( T ) + g ( T ) | T | LB on avg # 64 47 games won 448 > wz + gz 55
Pf of theorem. ļ® Use max flow formulation, and consider min cut (A, B). ļ® Define T* = team nodes on source side of min cut. ļ® Observe x-y ā A iff both x ā T* and y ā T*.
Pf of theorem. ļ® Use max flow formulation, and consider min cut (A, B). ļ® Define T* = team nodes on source side of min cut. ļ® Observe x-y ā A iff both x ā T* and y ā T*. ļ® ! ļ® Rearranging terms: āŖ g ( S " { z }) > cap ( A , B ) = g ( S " { z }) " g ( T *) capacity of game edges leaving s 6 4447 4448
capacity of team edges leaving s 6 4447 4448 = g ( S " { z }) " g ( T *) " w ( T *) + | T * | ( wz + gz ) ! wz + gz < w ( T^ *)^ +^ g ( T^ *) | T * |
61
Feasible matrix rounding. ļ® Given a p-by-q matrix D = {dij } of real numbers. ļ® Row i sum = ai, column j sum bj. ļ® Round each dij, ai, bj up or down to integer so that sum of rounded elements in each row (column) equals row (column) sum. ļ® Original application: publishing US Census data. Goal. Find a feasible rounding, if one exists. Remark. "Threshold rounding" can fail. 0.35 0.35 0.35 1. 0.55 0.55 0.55 1. 0.9 0.9 0. original matrix feasible rounding 0 0 1 1 1 1 0 2 1 1 1 62
Theorem. Feasible matrix rounding always exists. Pf. Formulate as a circulation problem with lower bounds. ļ® Original data provides circulation (all demands = 0). ļ® Integrality theorem ā integral solution ā feasible rounding. āŖ 3.14 6.8 7.3 17. 9.6 2.4 0.7 12. 3.6 1.2 6.5 11. 16.34 10.4 14.5 s 1 2 3 1' 2' 3' t row column 17, 18 12, 13 11, 12 16, 17 10, 11 14, 15 3, 4 0, ā lower bound upper bound