CSE 421
Max Flow Min Cut, Bipartite Matching
Shayan Oveis Gharan
1
CSE 421 Max Flow Min Cut, Bipartite Matching Shayan Oveis Gharan - - PowerPoint PPT Presentation
CSE 421 Max Flow Min Cut, Bipartite Matching Shayan Oveis Gharan 1 Residual Graph capacity Original edge: e = (u, v) E. u v 17 Flow f(e), capacity c(e). 6 flow Residual edge. "Undo" flow sent. e = (u, v) and e
Shayan Oveis Gharan
1
Original edge: e = (u, v) ๏ E.
Residual edge.
๐๐ ๐ = แ๐ ๐ โ ๐ ๐ ๐๐ ๐ โ ๐น ๐ ๐ ๐๐ ๐๐ โ ๐น Residual graph: Gf = (V, Ef ).
๐ =
๐ โถ ๐ ๐ < ๐ ๐ โช {๐ โถ ๐(๐๐) > 0}.
2
u v 17 6 capacity u v 11 residual capacity 6 residual capacity flow
3
Augment(f, c, P) { b ๏ฌ bottleneck(P) foreach e ๏ P { if (e ๏ E) f(e) ๏ฌ f(e) + b else f(eR) ๏ฌ f(e) - b } return f } Ford-Fulkerson(G, s, t, c) { foreach e ๏ E f(e) ๏ฌ 0 Gf ๏ฌ residual graph while (there exists augmenting path P) { f ๏ฌ Augment(f, c, P) update Gf } return f } Smallest capacity edge on P Forward edge Reverse edge
Augmenting path theorem. Flow f is a max flow iff there are no augmenting paths. Max-flow min-cut theorem. [Ford-Fulkerson 1956] The value of the max s-t flow is equal to the value of the min s-t cut. Proof strategy. We prove both simultaneously by showing the TFAE: (i) There exists a cut (A, B) such that v(f) = cap(A, B). (ii) Flow f is a max flow. (iii) There is no augmenting path relative to f. (i) ๏ (ii) This was the corollary to weak duality lemma. (ii) ๏ (iii) We show contrapositive. Let f be a flow. If there exists an augmenting path, then we can improve f by sending flow along that path.
4
(iii) => (i) No augmenting path for f => there is a cut (A,B): v(f)=cap(A,B)
5
๐ค ๐ = เท
๐ out of ๐ต
๐ ๐ โ เท
๐ in to ๐ต
๐(๐) = เท
๐ out of ๐ต
๐ ๐ = ๐๐๐(๐ต, ๐ถ)
๐๐ (๐) remains an integer throughout the algorithm.
๐ค(๐โ) ๏ฃ ๐๐ท iterations, if ๐โ is optimal flow.
Integrality theorem. If all capacities are integers, then there exists a max flow f for which every flow value f(e) is an integer.
6
Given an undirected graph G = (V, E). A set ๐ โ ๐น is a matching if each node appears in at most one edge in M. Goal: find a matching with largest cardinality.
8
Given an undirected bibpartite graph ๐ป = (๐ โช ๐, ๐น) A set ๐ โ ๐น is a matching if each node appears in at most one edge in M. Goal: find a matching with largest cardinality.
9
1 3 5 1' 3' 5' 2 4 2' 4'
X Y
Create digraph H as follows:
10
s 1 3 5 1' 3' 5' t 2 4 2' 4' 1 1
โ
Y X
H
Given max matching M of cardinality k. Consider flow f that sends 1 unit along each of k edges of M. f is a flow, and has cardinality k. โช
11
1 3 5 1' 3' 5' 2 4 2' 4'
G
4 4' s 1 3 5 1' 3' 5' t 2 2' 1 1
โ H
Integrality theorem ๏ k is integral and we can assume f is 0-1. Consider M = set of edges from X to Y with f(e) = 1.
12
s 1 3 5 1' 3' 5' t 2 4 2' 4' 1 1
โ H
1 3 5 1' 3' 5' 2 4 2' 4'
G
exactly one edge in M.
Structure of bipartite graphs with perfect matchings:
14
and let N(S) be the set of nodes adjacent to nodes in S.
perfect matching, then |N(S)| ๏ณ |S| for all subsets S โ ๐.
15
S N(S) S N(S)
16
Formulate as a max-flow and let (๐ต, ๐ถ) be the min s-t cut G has no perfect matching => ๐ค ๐โ < |๐|. So, ๐๐๐ ๐ต, ๐ถ < |๐| Define ๐๐ต = ๐ โฉ ๐ต, ๐๐ถ = ๐ โฉ ๐ถ, ๐
๐ต = ๐ โฉ ๐ต
Then, ๐๐๐ ๐ต, ๐ถ โฅ ๐๐ถ + |๐
๐ต|
Since min-cut does not use โ edges, ๐ ๐๐ต โ ๐
๐ต
๐ ๐๐ต โค ๐
๐ต โค ๐๐๐ ๐ต, ๐ถ โ ๐๐ถ = ๐๐๐ ๐ต, ๐ถ โ ๐ + ๐๐ต < |๐๐ต|
17
s t
๐๐ต ๐๐ถ ๐
๐ถ
๐
๐ต
โ
Which max flow algorithm to use for bipartite matching? Generic augmenting path: O(m val(f*) ) = O(mn). Capacity scaling: O(m2 log C ) = O(m2). 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(n4). [Edmonds 1965] Best known: O(m n1/2). [Micali-Vazirani 1980]
18