GRAPH ALGORITHMS Week 7 (13 Nov - 18 Nov 2017)

Similar documents
Agenda. Soviet Rail Network, We ve done Greedy Method Divide and Conquer Dynamic Programming

1 Matchings in Non-Bipartite Graphs

Part V. Matchings. Matching. 19 Augmenting Paths for Matchings. 18 Bipartite Matching via Flows

7.5 Bipartite Matching

Maximum flow problem (part I)

Combinatorial Optimization

Maximum flow problem

Notes on Graph Theory

Algorithm Design and Analysis

M-saturated M={ } M-unsaturated. Perfect Matching. Matchings

GRAPH ALGORITHMS Week 3 (16-21 October 2017)

Graphs and Network Flows IE411. Lecture 12. Dr. Ted Ralphs

Chapter 7 Matchings and r-factors

- Well-characterized problems, min-max relations, approximate certificates. - LP problems in the standard form, primal and dual linear programs

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Network Flows. CTU FEE Department of control engineering. March 28, 2017

Algorithm Design and Analysis

6.046 Recitation 11 Handout

Preliminaries. Graphs. E : set of edges (arcs) (Undirected) Graph : (i, j) = (j, i) (edges) V = {1, 2, 3, 4, 5}, E = {(1, 3), (3, 2), (2, 4)}

Two Applications of Maximum Flow

Maximum flow problem CE 377K. February 26, 2015

Mathematical Programs Linear Program (LP)

Algorithms and Theory of Computation. Lecture 11: Network Flow

On improving matchings in trees, via bounded-length augmentations 1

Lecture 5 January 16, 2013

Maximum Flow. Reading: CLRS Chapter 26. CSE 6331 Algorithms Steve Lai

Algorithms: Lecture 12. Chalmers University of Technology

ACO Comprehensive Exam March 17 and 18, Computability, Complexity and Algorithms

The Maximum Flow Problem with Disjunctive Constraints

Discrete Optimization 2010 Lecture 3 Maximum Flows

4. Duality Duality 4.1 Duality of LPs and the duality theorem. min c T x x R n, c R n. s.t. ai Tx = b i i M a i R n

Lecture 2: Network Flows 1

5 Flows and cuts in digraphs

15.1 Matching, Components, and Edge cover (Collaborate with Xin Yu)

An algorithm to increase the node-connectivity of a digraph by one

Constructive proof of deficiency theorem of (g, f)-factor

MINIMALLY NON-PFAFFIAN GRAPHS

Advanced Combinatorial Optimization September 22, Lecture 4

Zero-Sum Flows in Regular Graphs

3.7 Cutting plane methods

Alternating paths revisited II: restricted b-matchings in bipartite graphs

Parity Versions of 2-Connectedness

List of Theorems. Mat 416, Introduction to Graph Theory. Theorem 1 The numbers R(p, q) exist and for p, q 2,

Packing and Covering Dense Graphs

3. Linear Programming and Polyhedral Combinatorics

Lecture 3. 1 Polynomial-time algorithms for the maximum flow problem

Generalized Pigeonhole Properties of Graphs and Oriented Graphs

The maximum flow problem

3.4 Relaxations and bounds

Week 4. (1) 0 f ij u ij.

Factors in Graphs With Multiple Degree Constraints

Disjoint paths in unions of tournaments

FRACTIONAL PACKING OF T-JOINS. 1. Introduction

3.7 Strong valid inequalities for structured ILP problems

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

RECAP How to find a maximum matching?

CMPSCI 611: Advanced Algorithms

CS 138b Computer Algorithm Homework #14. Ling Li, February 23, Construct the level graph

Cutting Plane Methods II

Spanning Paths in Infinite Planar Graphs

Flows and Cuts. 1 Concepts. CS 787: Advanced Algorithms. Instructor: Dieter van Melkebeek

CS675: Convex and Combinatorial Optimization Fall 2014 Combinatorial Problems as Linear Programs. Instructor: Shaddin Dughmi

Introduction to Graph Theory

Approximation Algorithms for Asymmetric TSP by Decomposing Directed Regular Multigraphs

Discrete Optimization 23

Running Time. Assumption. All capacities are integers between 1 and C.

The Algorithmic Aspects of the Regularity Lemma

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Preliminaries and Complexity Theory

On a Cardinality-Constrained Transportation Problem With Market Choice

arxiv: v1 [math.co] 22 Jan 2018

MATROID PACKING AND COVERING WITH CIRCUITS THROUGH AN ELEMENT

Flow Network. The following figure shows an example of a flow network:

Mathematics for Decision Making: An Introduction. Lecture 13

Antoni Marczyk A NOTE ON ARBITRARILY VERTEX DECOMPOSABLE GRAPHS

Optimization Exercise Set n. 4 :

CSCE423/823. Introduction. Flow Networks. Ford-Fulkerson Method. Edmonds-Karp Algorithm. Maximum Bipartite Matching 2/35 CSCE423/823.

Chapter 7 Network Flow Problems, I

Combinatorial Optimisation, Problems I, Solutions Term /2015

Advanced Linear Programming: The Exercises

1 Perfect Matching and Matching Polytopes

6. Linear Programming

Induced subgraphs of prescribed size

CSC2420: Algorithm Design, Analysis and Theory Spring (or Winter for pessimists) 2017

directed weighted graphs as flow networks the Ford-Fulkerson algorithm termination and running time

Cost-Constrained Matchings and Disjoint Paths

Soviet Rail Network, 1955

ACYCLIC DIGRAPHS GIVING RISE TO COMPLETE INTERSECTIONS

RESEARCH INSTITUTE FOR MATHEMATICAL SCIENCES RIMS Covering Cuts in Bridgeless Cubic Graphs. Sylvia BOYD, Satoru IWATA, Kenjiro TAKAZAWA

Paths and cycles in extended and decomposable digraphs

Graph G = (V, E). V ={vertices}, E={edges}. V={a,b,c,d,e,f,g,h,k} E={(a,b),(a,g),( a,h),(a,k),(b,c),(b,k),...,(h,k)}

Decomposing dense bipartite graphs into 4-cycles

CSC Design and Analysis of Algorithms. LP Shader Electronics Example

arxiv: v1 [math.co] 5 May 2016

Coloring. Basics. A k-coloring of a loopless graph G is a function f : V (G) S where S = k (often S = [k]).

On shredders and vertex connectivity augmentation

Graph coloring, perfect graphs

Acyclic Digraphs arising from Complete Intersections

Minimum cost transportation problem

Problem set 1. (c) Is the Ford-Fulkerson algorithm guaranteed to produce an acyclic maximum flow?

Transcription:

GRAPH ALGORITHMS Week 7 (13 Nov - 18 Nov 2017) C. Croitoru croitoru@info.uaic.ro FII November 12, 2017 1 / 33

OUTLINE Matchings Analytical Formulation of the Maximum Matching Problem Perfect Matchings Tutte s Theorem Maximum Cardinality Matchings Berge s Theorem Maximum Cardinality Matchings Hopcroft-Karp Algorithm Network Flows Flow Network Flow, Flow Value, Maximum Flow Problem Augmenting Paths 2 / 33

Analytical Formulation of the Maximum Matching Problem G = (V, E) graph, M G family of all matchings in G Maximum Matching Problem: P1 Given a graph G = (V, E), find M M G such that M = max{ M M M G }. Let B = (b ij ) n m be the incidency matrix of G (a fixed ordering of the n vertices of G and { a fixed ordering of the m edges of G are considered) with 1 if the edge j is incident with vertex i b ij =. If e p is the p-dimensional 0 otherwise vector with all components 1, then the problem P1 can be written equivalently: P1 max{e T mx Bx e n, x 0, x i {0, 1} i = 1, m} P1 is an ILP (Integer Linear Programming) problem, which is NP-hard. We can try to solve P1, using the (relaxed) LP (linear Programming) problem associated LP1 max{e T mx Bx e n, x 0}. 3 / 33

Analytical Formulation of the Maximum Matching Problem The optimal solutions of LP can have non-integer components and also their optimal values can be larger than ν(g). For example, if G = C 2n+1, then ν(c 2n+1 ) = n, but the solution x i = 1 2 i = 1, 2n + 1 is optimal for the corresponding LP with optimal value n + 1 2 > n. 1/2 1/2 1/2 1/2 1/2 It follows that if the graph G has odd circuits, the problem P1 can not be solved using LP. More precisely, Theorem 2. (Balinski 1971) The extreme points of the polytope Bx e n, x 0, x R m, have components in {0, 1 2, 1}. The components 1 2 arises if and only if G has odd circuits. 4 / 33

Analytical Formulation of the Maximum Matching Problem Hence the problem P1 is easy if the graph is bipartite: solve the problem LP1 and the (integer) optimal solution found is an optimal solution for P1. Combinatorial adaptation of the simplex algorithm for solving linear programming problems led to the so called hungarian method for solving P1 for bipartite graphs. We will discuss a faster solution given by Hopcroft and Karp (1973). However, the theorem of duality in linear programming and the integrity of the optimal solution can be used obtain and explain the (already proven) results on mathchings in bipartite graphs: Theorem 3. (Hall, 1935) Let G = (S, T ; E) be a bipartite graph. There exists a mathching in G which saturates all the vertices in S if and only if N G (A) A A S. Theorem 4. (Konig,1930) Let G = (S, T ; E) be a bipartite graph. The maximum cardinality of a matching in G is equal with the minimum cardinality of a vertex cover ν(g) = n α(g) 5 / 33

Perfect Matchings Tutte s Theorem V (G) Let G be graph. Clearly, M 2, M M G. A perfect matching (or V (G) 1-factor) in G is a matching M with the property M = 2 (that is, S(M) = V (G)). A connected component of graph G is even ( odd) if the number of its vertices is even (odd).we denote by q(g) the number of odd connected components of G. Remark. Let G be a graph having a perfect matching. Clearly, each connected component of G is even. Hence q(g) = 0. Moreover, if S V (G) then for each odd connected component of the graph G S must exist an edge in the perfect matching of the graph with an extremity in this connected component and the other in S. Since the extremities of different edges are distinct, it follows that S q(g S). For S =, we obtain q(g ) = 0, hence q(g) = 0. 6 / 33

Perfect Matchings Tutte s Theorem Theorem 5. (Tutte, 1947) A graph G has a perfect matching if and only if (T ) q(g S) S S V. Proof. The necessity of condition (T ) has been already observed in the above discussion. We prove by induction on n = V that if a graph G = (V, E) satisfies (T ) then G has a perfect matching. For n = 1, 2 the theorem holds obviously. In the inductive step, let G be a graph with n 3 vertices which satisfies (T ), and suppose that any graph G with G < n and which satisfies (T ) has a perfect matching. Let S 0 V (G) such that q(g S 0 ) = S 0 and maximal with the property that we have equality in (T ) (for any superset S of S 0 (S 0 S q(g S) < S ). Note that the family of subsets of V (G) for which (T ) is satisfied with equality is non-empty, and therefore S 0 exists (for each vertex v 0 which is not vertex-cut, we have q(g {v 0 }) = 1 = {v 0 }, since each connected component is even, and in each connected component with at least one vertex, there is such a vertex v 0 ). 7 / 33

Perfect Matchings Tutte s Theorem Let m = S 0 > 0, C 1,..., C m the odd connected components of G S 0 and D 1,..., D k the even connected components of G S 0, (k 0): D1 C1 C2 D2 s2 s3 C3 s1 sm Dk We will construct a perfect matching composed by a) a perfect matching in each even connected component D i ; b) a matching with m edges, the edge e i (i = 1, m) having an extremity in s i S 0 and the other v i C i ; c) a perfect matching in each subgraph [C i v i ] G (i = 1, m). Cm 8 / 33

Perfect Matchings Tutte s Theorem a) For each i = 1, k the graph [D i ] G has a perfect matching. Indeed, since m > 0, it follows that D i < n and by the induction hypothesis it is sufficiently to show that G = [D i ] G satisfies (T ). Let S D i. If q(g S) > S, then q(g S 0 S) = q(g S 0 ) + q(g S) = S 0 + q(g S) > S 0 + S = S 0 S, contradiction (G satisfies (T )). Hence q(g S) S, S V (G ), that is, G = [D i ] G satisfies (T). b) Let H = (S 0, {C 1,..., C m }; E ) be the bipartite graph with a class of the bipartition S 0, the other class the set of odd connected components of G S 0, and edges of H are all {s, C i } with s S 0 and i = 1, m such that there is v C i with sv e(g). s1 s2 s3 C1 C2 C3 sm Cm 9 / 33

Perfect Matchings Tutte s Theorem H has a perfect matching. Indeed, we show that H satisfies Hall s condition for the existence of matching M 0 that saturates {C 1,..., C m }: A {C 1,..., C m }, N H (A) A. Since S 0 = m, it follows that M 0 is a perfect matching in H. Let A {C 1,..., C m }. Then B = N H (A) S 0, and by the construction of H, in the graph G we have no edge from a vertex v S 0 B to a vertex w C i, for C i A. Hence the odd connected components of G S 0 remains odd connected components in G B. It follows that q(g B) A. Since G satisfies Tutte s condition (T ), we have B q(g B). We obtained that B A, that is N H (A) A. Since A was chosen arbitrarily in {C 1,..., C m }, it follows that H has a perfect matching: M 0 = {s 1 v 1, s 2 v 2,..., s m v m } with S 0 = {s 1,..., s m } and v i C i i = 1, m. 10 / 33

Perfect Matchings Tutte s Theorem c) i {1,..., m} the graph G = [C i v i ] G has a perfect matching. Using the induction hypothesis, it is sufficiently to prove that G satisfies (T ). Let S C i v i. If q(g S) > S, then, since q(g S) + S 0 (mod 2), it follows that q(g S) S + 2. If S = S 0 {v i } S, we have S q(g S ) = q(g S 0 ) 1 + q(g S) = S 0 1 + q(g S) S 0 1 + S + 2 = S, that is, q(g S ) = S, contradicting the choice of S 0 since S 0 S. Therefore S C i v i, q(g S) S and G has a perfect matching (by the induction hypothesis). Obviously the matching of G obtained by taking the union of the matchings in a), b), and c) above saturates all the vertices of G, and the theorem follows by induction. 11 / 33

Maximum Cardinality Matchings Berge s Theorem Let G = (V, E) be a graph and M M G a matching in G. Definition. An alternating path of G with respect to the matching M is any path P : v 0, v 0 v 1, v 1,..., v k 1, v k 1 v k, v k such that i = 1, k 1 {v i 1 v i, v i v i+1 } M. Note that, since M is a matching, if P is an alternating path w.r.t. M, then from any two consecutive edges of P exactly one belongs to M (the edges belong alternatively to M and E M. In the following, when we will refer to a path P we understand its set of edges. Definition. An augmenting path in G w.r.t. the matching M is an alternating path joining two distinct exposed vertices with respect to M. 12 / 33

Maximum Cardinality Matchings Berge s Theorem Note that, from the above definition, it follows that if P is an augmenting path w.r.t. M, then P M = P M + 1. b a c e d f g i j h a, b, c, d - drum alternat par f - drum alternat impar j - drum de crestere g, f, d - drum alternat impar a, b, c, d, e - drum alternat inchis a, b, c, d, f, g, h - drum de crestere 13 / 33

Maximum Cardinality Matchings Berge s Theorem Theorem 6. (Berge 1959) M is a maximum cardinality matching in the graph G if and only if there is no augmenting path in G w.r.t. M. Proof. Let M be a maximum cardinality matching in G. Suppose that P is an augmenting paths in G with respect to M. Then, M = M P = (P M) (M P) is a matching in G. Indeed, M can be obtained by interchanging the edges in M with those not in M on the path P: a e f g h b d i c j P= a, b, c, d, f, g, h - drum de crestere (M-P) u (P-M) Furthermore, M = P M + 1 + M P = M + 1, contradicting the choice of M. 14 / 33

Maximum Cardinality Matchings Berge s Theorem Let M be a matching in G with the property that there are no augmenting paths in G with respect to M. Let M a maximum cardinality matching in G. We ll prove that M = M. Let G the subgraph spanned by M M in G (G = (V, M M )). Note that d G (v) 2 v V and therefore the connected components of G are isolated nodes, paths of length at least one, or circuits. We have the following possibilities (thick edges are from M, thin edges are from M): a b c d e Case b) does not appear since it is an augmenting path with respect to M, which is a maximum cardinality matching. Case c) does not appear since it is an augmenting path with respect to M 15 / 33

Maximum Cardinality Matchings Berge s Theorem If we denote by m M (C) the number of edges from M in the connected component C of G and by m M (C) the number of edges from M in the same connected component of G, we obtained that m M (C) = m M (C). Hence M M = m C (M) = m C (M ) = M M C c.comp. of G C c.comp. of G Therefore M = M. It follows the following strategy to find a maximum cardinality matching: a) let M be a matching in G (e.g., M = ); b) while P augmenting path w.r.t. M do M M P At each while iteration the cardinality of the current matching increases by 1, therefore in at most n 2 iterations we obtain a matching without augmenting paths, that is (by Berge s Theorem) of maximum cardinality. The problem with this algorithm is that while condition must be implemented in polynomial time. This was firstly done by Edmonds (1965). 16 / 33

Maximum Cardinality Matchings Hopcroft-Karp Algorithm Lemma 1. Let M, N M G, M = r, N = s and s > r. Then in M N there are at least s r vertex-disjoint augmenting paths with respect to M. Proof. Let G = (V, M N) and C i i = 1, p be the connected components of G. For each i {1,..., p}, we denote by δ(c i ) the difference between the number of edges of N in C i and the number of edges of M in C i : δ(c i ) = E(C i ) N E(C i ) M. Note that, since M and N are matchings, C i are paths or circuits. Hence δ(c i ) { 1, 0, 1}. δ(c i ) = 1 if and only if C i is an augmenting path with respect to M. Since δ(c i ) = N M M N = s r, i=1,p it follows that there are at least s r C i with δ(c i ) = 1, that is, are at least s r vertex-disjoint augmenting paths contained in M N. 17 / 33

Maximum Cardinality Matchings Hopcroft-Karp Algorithm Lemma 2. If ν(g) = s and M M G with M = r < s, then there is in G an augmenting path with respect to M of length at most 2 r/(s r) + 1. Proof. Let N M G with N = s = ν(g). By Lemma 1, there are s r edge-disjoint augmenting paths (vertex-disjoint paths are also edge-disjoint) contained in M N. It follows that at least one of them has at most r/(s r) edges from M. the length of this augmenting path is at most 2 r/(s r) + 1. Definition. Let M M G. A minimum augmenting path with respect to M in G is an augmenting path of minimum length over all augmenting paths with respect to M in G. Lemma 3. Let M M G and P a minimum augmenting path with respect to M and P an augmenting path with respect to M P. Then P P + 2 P P. Proof. Let N = (M P) P. Then M N = P P and N = M + 2. By Lemma 1, there are P 1, P 2 edge-disjoint augmenting paths with respect to M contained in M N. Since P is a minimum augmenting path w.r.t. M, we have P P P 1 + P 2 2 P and therefore P + P 2 P P 2 P. 18 / 33

Maximum Cardinality Matchings Hopcroft-Karp Algorithm Let us consider the following algorithm: ( ) M 0 ; M i+1 M i P i ( P i minimum augmenting path w.r.t. M i ; i 0.) Let P 0, P 1,..., P ν(g) 1 be the sequence of minimum augmenting paths constructed by this algorithm. Lemma 4. a) i = 1, ν(g) 2, P i P i+1 ; P i = P i+1 P i and P i+1 are vertex-disjoint. b) i < j < ν(g) 1, if P i = P j then P i and P j are vertex-disjoint. Proof. a) By taking P = P i and P = P i+1 in Lemma 3, we obtain P i+1 P i + 2 P i P i+1 P i. The equality holds if and only if P i and P i+1 are edge-disjoint, which implies that they are vertex-disjoint (since they are alternating paths). b) follows by applying successively a) 19 / 33

Maximum Cardinality Matchings Hopcroft-Karp Algorithm Theorem 7. (Hopcroft, Karp 1973) Let G be a graph and ν(g) = s. The number of distinct integers in the sequence P 0, P 1,..., P s 1 (P i are the minimum augmenting paths constructed by the above algorithm) is not greater than 2 s + 2. Proof. Let r = s s. Then M r = r and P r 2 r/(s r) + 1 = 2 s s /(s s s ) + 1 < 2 s + 1. Hence, for every i < r, P i is one of s + 1 odd integers not greater than 2 s + 1. In the sub-sequence P r,..., P s 1 there are at most s r s + 1 distinct integers. It follows that in the entire sequence P 0, P 1,..., P s 1 there are no more than 2 s + 2 distinct integers. 20 / 33

Maximum Cardinality Matchings Hopcroft-Karp Algorithm If the algorithm ( ) is decomposed in phases such that in each phase a maximal (w.r.t. incluion) set of vertex-disjoint minimum augmenting paths is found, then by Lemma 4 the length of the minimum augmenting paths in the next phase will increase (otherwise, the set of minimum augmenting paths constructed in the current stage is not maximal). By Theorem 7, we obtain that the number of phases is not greater than 2 ν(g) + 2. Hence we have the following algorithm to find a maximum cardinality matching in a given graph G: 0. M ; 1. repeat Find P a maximal set of vertex-disjoint minimum augmenting paths w.r.t. M for P P do M M P until P =. 21 / 33

Maximum Cardinality Matchings Hopcroft-Karp Algorithm The time complexity of the above algorithm is O( na), where A is the time complexity of the determination of the set P. In the case of bipartite graphs, Hopcroft and Karp shown that this can be obtained in O(n + m) time and therefore the entire algorithm has O(mn 1/2 ) running time. This has been extended to arbitrary graphs by Micali and Vazirani (1980) using an elaborate data structure to maintain the labels associated to vertices in order to construct minimum augmenting paths. Consider the case of bipartite graphs: G = (S, T ; E) and M M G. Starting from one of the classes, say S, we consider the set of initial extremities of augmenting paths S E(M). From each such vertex we start, in parallel, the construction of alternating paths in a bfs manner. The first augmenting path obtained stop the construction, giving the minimum length of an augmenting path. The set P is obtained using the labels and the adjacency lists in O(n + m). Details are omitted, an example is given on he next slide. 22 / 33

Maximum Cardinality Matchings Hopcroft-Karp Algorithm familie maximala de 1- drumuri de crestere 23 / 33

Network Flows Maximum Flow Problem Flow Network A flow network (transportation network) with source s and sink t is a tuple R = (G, s, t, c) where: G = (V, E) is a digraph, s, t V ; s t; d + G (s) > 0; d G (t) > 0, c : E R + ; c(e) is the capacity of the arc e. We will suppose that V = {1, 2,..., n} (n N ) and E = m. We extend the function c to c : V V R + by { c(ij) if ij E c((i, j)) = 0 if ij / E and will denote c((i, j)) = c ij. 24 / 33

Network Flows Maximum Flow Problem Flow Definition. A flow in R = (G, s, t, c) is a function x : V V R s.t. Remarks. (i) 0 x ij c ij (ii) j V x ji j V ij V V x ij = 0 i V {s, t} 1 If ij E then x ij is referred as the flow (transported) on ij. 2 Constraints (i) require that the flow on each arc is non-negative and does not exceed the capacity. 3 Constraints (ii), (equilibrium constraints), require that the sum of flows on the arcs entering vertex i is equal to the sum of flows on the arcs leaving i (flow in equals flow out). 4 Note that, by the way the function c have been extended to V V, the constraints (i) implies that x ij = 0 whenever ij E. Hence a flow is in fact a function on E. We prefer its extension on V V to simplify the notations. 25 / 33

Network Flows Maximum Flow Problem Flow value Let x be a flow in R = (G, s, t, c). If we add all constraints (ii) (for i V {s, t}) we have 0 = ( i s,t j V x ji j V x ) ij = i s,t j s,t x ji i s,t i s,t x si + i s,t x ti i s,t x is i s,t x it = ( i x is i x ) ( si i x it i x ti), that is, x jt x tj = ( x js ) x sj. j V j V j V j V Definition. The value of the flow x in R = (G, s, t, c) is v(x) = j V x jt j V x tj. j s,t x ij+ In words, v(x) is the net flow reaching the sink of the network or, as we proved, the net flow leaving the source of the network. 26 / 33

Network Flows Maximum Flow Problem Note that in any network R = (G, s, t, c) there is a flow: x 0, the null flow, with x 0 ij = 0 ij, and v(x 0 ) = 0. Maximum Flow Problem: Given R = (G, s, t, c) a flow network, find a flow of maximum value. The Maximum Flow Problem can be viewed as an LP problem: max v j x ji j x ij = 0, i s, t j x js j x sj = v j x jt j x tj = v 0 x ij c ij ij However, we will consider a direct combinatorial approach which is important when some integrality constraints are imposed to the variables (flows on the directed edges). 27 / 33

Network Flows Maximum Flow Problem Network v source sink Find the maximum amount of material flowing through the network from source to sink 28 / 33

Network Flows Maximum Flow Problem Augmenting Paths Definition. Let P be a path in G the support graph of the directed graph G and e = v i v j an edge of P, e E(P). If e corresponds to the arc v i v j, then e is a forward arc of P, otherwise (e corresponds to the arc v j v i ) e is a backward arc of P. G P Ḡ - arc direct arc invers Definition. Let R = (G, s, t, c) be a flow network and x a flow in R. An A-path (in R with respect to the flow x) is a path P in G such that ij E(P) : if ij is a forward arc, then x ij < c ij, if ij is a backward arc, then x ji > 0. 29 / 33

Network Flows Maximum Flow Problem Augmenting Paths If P is an A-path in { R w.r.t flow x, then the residual capacity of c ij x ij if ij is a forward arc in P ij E(P) is r(ij) = x ji if ij is a backward arc in P. The residual capacity of the path P is r(p) = min r(e). e E(P) Example: Let us consider the flow network below, where, on each edge, the first labeled is its capacity and the second label is the flow on it. 3,1 2 2,1 4 3,2 s 1 1,0 1,0 1,1 6 t 2,2 3 2,2 5 2,1 P : 1, 12, 2, 24, 4, 45, 5, 56, 6 is an A-path from s to t with forward arcs 12 (x 12 = 1 < c 12 = 3); 24(x 24 = 1 < c 24 = 2); 56(x 56 = 1 < c 56 = 2) and backward arc 45(x 54 = 1 > 0). Residual capacity of P: r(p) = min(min(2, 1, 1), 1) = 1. 30 / 33

Network Flows Maximum Flow Problem Augmenting Paths Definition. An augmenting path of the flow x in the flow network R = (G, s, t, c) is an A-path from s to t. Lemma 1. If P is an augmenting path of the flow x in R = (G, s, t, c), then x 1 = x r(p) defined by x ij xij 1 = x ij + r(d) x ij r(d) if ij / E(P) is a flow in R with v(x 1 ) = v(x) + r(p). if ij E(D), ij forward arc in P if ji E(D), ji backward arc in P Proof. By the definition of r(p), the constraints (i) are fulfilled by x 1. The constraints (ii) verified by x are not affected for x 1 in a vertex i V (P). For i V (P) there are exactly two arcs of P incident with i, say li and ik. We have the following possible cases: 31 / 33

Network Flows Maximum Flow Problem Augmenting Paths a) li and ik forward arcs: j x 1 ji j x 1 ij = j l x ji j k x ij + x 1 li x 1 ik = j l x ji j k x ij + x li + r(p) x ik r(p) = j x ji j x ij = 0. b) li forward arc, ik backward arc: j x 1 ji j x 1 ij = j l,k x ji j x ij + x 1 li + x 1 ki = j l,k x ji j x ij + x li + r(p) + x ki r(p) = j x ji j x ij = 0. c) li backward arc, ik forward arc: similarly to b). d) li and ik backward arcs: similarly to a). v(x 1 ) differs from v(x) because of the flow on the arc lt of P: lt forward arc: v(x 1 ) = j x 1 jt j x 1 tj = j l x jt j x tj + x 1 lt = j l x jt j x tj + x lt + r(p) = v(x) + r(p). lt backward arc: v(x 1 ) = j x 1 jt j x 1 tj = j x jt j l x tj x 1 tl = j x jt j l x tj (x tl r(p)) = v(x) + r(p). Hence the lemma is proved. 32 / 33

Network Flows Maximum Flow Problem Augmenting Paths For the example on slide 30, the flow x 1 = x r(p) of value v(x 1 ) = v(x) + r(p) = 3 + 1 = 4 is: 3,2 2 2,2 4 3,2 s 1 1,0 1,0 1,0 6 t Remarks. 2,2 3 2,2 The above lemma explains the names augmenting path and residual capacity. By the definition, if P is an augmenting path, then r(p) > 0 and thus v(x r(d)) > v(x). It follows that if there is an augmenting path of the flow x, then x is not a flow of maximum value. 33 / 33 5 2,2