5.7.2 A Maximum flow algorithm

Slides:



Advertisements
Similar presentations
Lecture 7. Network Flows We consider a network with directed edges. Every edge has a capacity. If there is an edge from i to j, there is an edge from.
Advertisements

Min-Max Relations, Hall’s Theorem, and Matching-Algorithms Graphs & Algorithms Lecture 5 TexPoint fonts used in EMF. Read the TexPoint manual before you.
 Theorem 5.9: Let G be a simple graph with n vertices, where n>2. G has a Hamilton circuit if for any two vertices u and v of G that are not adjacent,
Bipartite Matching, Extremal Problems, Matrix Tree Theorem.
15.082J & 6.855J & ESD.78J October 14, 2010 Maximum Flows 2.
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 8 Network models.
Piyush Kumar (Lecture 6: MaxFlow MinCut Applications)
Lectures on Network Flows
Yangjun Chen 1 Bipartite Graphs What is a bipartite graph? Properties of bipartite graphs Matching and maximum matching - alternative paths - augmenting.
04/12/2005Tucker, Sec Applied Combinatorics, 4 th Ed. Alan Tucker Section 4.4 Algorithmic Matching Prepared by Joshua Schoenly and Kathleen McNamara.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
CS138A Maximum Bipartite Matching Peter Schröder.
Matchings Matching: A matching in a graph G is a set of non-loop edges with no shared endpoints.
Chapter 26 of CLSR Bipartite Matching By Dr. M. Sakalli, Sources: Levitin and many other CSE, Marmara Univ. May/2009.
Maximum Bipartite Matching
Matchings Matching: A matching in a graph G is a set of non-loop edges with no shared endpoints Maximal Matching: A maximal matching in a graph is a matching.
Yangjun Chen 1 Bipartite Graph 1.A graph G is bipartite if the node set V can be partitioned into two sets V 1 and V 2 in such a way that no nodes from.
3/24/03Tucker, Section 4.31 Tucker, Applied Combinatorics, Sec. 4.3, prepared by Jo E-M Bipartite GraphMatching Some Definitions X-Matching Maximal Matching.
Khabbazian1 Copyright © Dale Carnegie & Associates, Inc. Mohammad Khabbazian Department of computer engineering,sharif University,Tehran,iran.
Maximum Bipartite Matching In a graph G, if no M-augmenting path exists, then M is a maximum matching in G. Idea: Iteratively seek augmenting paths to.
9.2 Graph Terminology and Special Types Graphs
CSE, IIT KGP Matchings and Factors. CSE, IIT KGP Matchings A matching of size k in a graph G is a set of k pairwise disjoint edges.A matching of size.
Hungarian Algorithm Vida Movahedi Elderlab, York University June 2007.
Advanced Algorithms Piyush Kumar (Lecture 4: MaxFlow MinCut Applications) Welcome to COT5405.
Stephane Durocher 1 Debajyoti Mondal 1 Md. Saidur Rahman 2 1 Department of Computer Science, University of Manitoba 2 Department of Computer Science &
Section 2.1 “Matching in bipartite graphs” in Graph Theory Handout for reading seminar.
5.8 Graph Matching  Example: Set of worker assign to a set of task  Four tasks are to be assigned to four workers.  – Worker 1 is qualified to do tasks.
 Rooted tree and binary tree  Theorem 5.19: A full binary tree with t leaves contains i=t-1 internal vertices.
CS 473Lecture ?1 CS473-Algorithms I Lecture ? Network Flows Finding Max Flow.
3.2 Matchings and Factors: Algorithms and Applications This copyrighted material is taken from Introduction to Graph Theory, 2 nd Ed., by Doug West; and.
1/24 Introduction to Graphs. 2/24 Graph Definition Graph : consists of vertices and edges. Each edge must start and end at a vertex. Graph G = (V, E)
Bipartite Matching. Unweighted Bipartite Matching.
5.8 Graph Matching  Example: Set of worker assign to a set of task  Four tasks are to be assigned to four workers.  – Worker 1 is qualified to do tasks.
Maximum Flow Chapter 26. Flow Concepts Source vertex s – where material is produced Sink vertex t – where material is consumed For all other vertices.
 Quotient graph  Definition 13: Suppose G(V,E) is a graph and R is a equivalence relation on the set V. We construct the quotient graph G R in the follow.
and 6.855J March 6, 2003 Maximum Flows 2. 2 Network Reliability u Communication Network u What is the maximum number of arc disjoint paths from.
Introduction to Graph Theory
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
Iterative Improvement for Domain-Specific Problems Lecturer: Jing Liu Homepage:
Indian Institute of Technology Kharagpur PALLAB DASGUPTA Graph Theory: Matchings and Factors Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering,
1. 期中测验时间和地点: 11 月 4 日, 上午 9:40—11 : 40 地点: 教室 2. 答疑时间和地点: 1)11 月 1 日 ( 周五 )13:00—15:00 软件楼 319 2)11 月 2 日和 3 日, 14:00—17:00 软件楼 3 楼 机房讨论室.
5.6 Prefix codes and optimal tree Definition 31: Codes with this property which the bit string for a letter never occurs as the first part of the bit string.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Trees.
Maximum Flow Chapter 26.
Bipartite Matching Lecture 8: Oct 7.
Bipartite Graphs What is a bipartite graph?
Algorithms and Networks
Algorithm Design and Analysis
Lectures on Network Flows
Richard Anderson Lecture 23 Network Flow
What is the next line of the proof?
Network Flow and Connectivity in Wireless Sensor Networks
Analysis of Algorithms
CS 583 Analysis of Algorithms
G-v, or G-{v} When we remove a vertex v from a graph, we must remove all edges incident with the vertex v. When a edge is removed from a graph, without.
R. Johnsonbaugh Discrete Mathematics 5th edition, 2001
Problem Solving 4.
Max Flow Min Cut, Bipartite Matching Yin Tat Lee
Systems of distinct representations
Bipartite Graph 1. A graph G is bipartite if the node set V can be partitioned into two sets V1 and V2 in such a way that no nodes from the same set are.
Piyush Kumar (Lecture 6: MaxFlow MinCut Applications)
Algorithms (2IL15) – Lecture 7
and 6.855J March 6, 2003 Maximum Flows 2
V12 Menger’s theorem Borrowing terminology from operations research
Lecture 21 Network Flow, Part 1
N(S) ={vV|uS,{u,v}E(G)}
Definition 8: Graphs that have a number assigned to each edge or each vertex are called weighted graphs weighted digraphs.
5.7 Transport Networks Transport Networks Transport Networks
Vertex Covers and Matchings
Presentation transcript:

5.7.2 A Maximum flow algorithm Lemma 5.3: Let f be a conservation flow, E(P,V-P) be a cut. If Vf=C(P,V-P), then Vfmax=Vf ,Cmin(P,V-P)=C(P,V-P). Proof: By the theorem 5.23, Theorem 5.23: For every conservation flow f and any cut E(P,V-P), the result holds: Vf C(P,V-P).

Frod,Falkerson 1956 1)We construct a initial conservation flow in N(V,E,C) Generally, we set fij0=0 for every edge (i,j) of N. The conservation flow is called zero flow. 2)We shall construct an increasing sequence of flows f 1, f 2,…, f n, that has to terminate in a maximal flow. How do we construct the increasing sequence?

Let u be an undirected path from s to t, (1)When u is a directed path from s to t, if fij<cij for every edge of the path, then we change fij for every edge of the path, which equals min{cij-fij} 1)Label s with (-,Δs), where Δs=+∞ 2)Suppose that vertex i is labeled, Let j be an adjacent vertex of i, and no labeled. If fij<cij,then j is labeled (i+, Δj), where Δj = min{Δi,cij- fij} 3)If t is labeled, then an increasing flow is constructed. We change fij to fij +Δt for every edge of the path u.

In the path (s,b,c,t) from s to t, edge (c,b) is reverse order .

Suppose that vertex b is labeled, If fcb>0,then c is labeled (b-,Δc), where Δc = min{Δb,fcb} If t is labeled, then an increasing flow is constructed. We change fij to fij +Δt when (i,j)E, if (i,j)E then we change fji to fji -Δt.

0) Construct a initial conservation flow in N(V,E,C). 1) Label s with (-,+∞). U={x|x is an adjacent vertex of s} 2)Suppose that vertex i is labeled, and j is no labeled, where jU. U=U-{j} i) If (i,j)E and fij<cij, then { j is labeled (i+, Δj), where Δj = min{Δi,cij- fij}, U=U∪{x|x is an adjacent vertex of j}. goto 3) } ii)If (j,i)E and fji>0,then {j is labeled (i-, Δj), where Δj = min{Δi,fji}. U=U∪{x|x is an adjacent vertex of j} } If j is not labeled, then goto 4) 3)If t is labeled then { We change fij to fij +Δt . if j is labeled with i+. If j is labeled with i-, then fji is changed to fji –Δt goto 1) else goto 2) 4)If U then goto 2) else stop.

Theorem 5.24: The labeling algorithm produces a maximum flow. Proof: P={x|x is labeled when algorithm end},thus V-P={ x|x is not labeled when algorithm end}. By the labeling algorithm, sP and tV-P. Thus E(P,V-P)is a cut. (1) (i,j) E(P,V-P)(i.e. iP. jV-P) fij=cij, (2) (j,i) E (i.e. iP. jV-P) fji=0. By lemma 5.3, the labeling algorithm produces a maximum flow.

5.8 Graph Matching Example: Set of worker assign to a set of task Four tasks are to be assigned to four workers. – Worker 1 is qualified to do tasks B and C – Worker 2 is qualified to do tasks A,C and D – Worker 3 is qualified to do tasks B and D – Worker 4 is qualified to do task A and C. Can all 4 workers be assigned to different tasks for which they are qualified?

Example 2: The Marriage Problem:Given a set of men, each of whom knows some women from a given set of women, under what conditions is it possible for all men to marry women they know? Four men each know some of four women Peter knows Mary and Ann Kevin knows Mary, Ann, Rose and Tina Brian knows Mary and Ann Fred knows Ann Is it possible for all the men to marry women they know? Graph Matching

Definition 36: A matching M in a graph G(V;E) is a subset of the edge set E such that no two edges in M are incident on the same vertex. The size of a matching M is the number of edges in M. For a graph G(V;E), a matching of maximum size is called a maximum matching. M1={e1,e7},M2={e1,e2,e5},M3={e1,e2,e5,e6}and M4= {e1,e2,e7,e8} are matching. M3 and M4 are maximum matching.

Definition 37: If M is a matching in a graph G, a vertex v is said to be M-saturated if there is an edge in M incident on v. Vertex v is said to be M-unsaturated if there is no edge in M incident on v. M1={e1,e7}, M3={e1,e2,e5,e6} M1-saturated : v M1-unsaturated: u M3-saturated:u,v

M={e1,e3,e7,e8}, M1={e1,e3,e5,e6} M1 and M are perfect matching. Definition 38: A matching M of G is perfect if all vertices of G are M-saturated. If G(V1;V2) is a bipartite graph then a matching M of G that saturates all the vertices in V1 is called a complete matching from V1 to V2.

M={{v1,u1},{v2,u2},{v3,u3}} M is a complete matching from V1 to V2, but it is not a complete matching from V2 to V1.

Definition 39: Given a matching M in a graph G, a M-alternating path (cycle) is a path (cycle) in G whose edges are alternately in M and outside of M (i.e. if an edge of the path is in M, the next edge is outside M and vice versa). A M-alternating path whose end vertices are M-unsaturated is called an M-augmenting path.

Theorem 5.25:M is a maximal matching of G iff there is no augmenting path relative to M. Proof: (1) There is no augmenting path relative to M, we prove M is a maximal matching of G . Suppose M and N are matching with |M|<|N|. To see that MN contains an augmenting path relative to M we consider G’ = (V’, MN ) 1≤dG’(v)≤2 Since |M|<|N|, MN has more edges from N than M and hence has at least one augmenting path relative to M contradiction

(2)If M is a maximal matching of G then there is no augmenting path relative to M Assume that there exists an M-augmenting path p. To see that Mp is a matching of G and |Mp|>|M| 1)Mp is a matching of G e1,e2Mp, e1 and e2 are not adjacent. 2) |Mp|>|M| |Mp|=|(M∪p)-(M∩p)|= |(M∪p)|-|(M∩p)| =|M|+|p|-2|(M∩p)| =|M|+1

N(S) ={vV|uS,{u,v}E(G)} Definition 40: Given a bipartite graph G(V1;V2), and a subset of vertices S V, the neighborhood N(S) is the subset of vertices of V that are adjacent to some vertex in S, i.e. N(S) ={vV|uS,{u,v}E(G)} A={v1,v3},N(A)={v2,v6,v4} A1={v1,v4},N(A1)={v2,v6,v4,v3,v5,v1}

Theorem 5. 26: Let G(V1,V2) be a bipartite graph with |V1|=|V2| Theorem 5.26: Let G(V1,V2) be a bipartite graph with |V1|=|V2|. Then a complete matching of G from V1 to V2 is a perfect matching

Theorem 5.27 (Hall's Theorem) Let G(V1; V2) be a bipartite graph with |V1|≤|V2|. Then G has a complete matching saturating every vertex of V1 iff |S|≤|N(S)| for every subset SV1 Example: Let G be a k-regular bipartite graph. Then there exists a perfect matching of G, where k>0. k-regular For AV1,E1={e|e incident a vertex of A}, E2={e|e incident a vertex of N(A)} For eE1, eE2. Thus E1E2. Therefore |E1|≤|E2|. Because k|A|=|E1|≤|E2|=k|N(A)|, |N(A)|≥|A|. By Hall’s theorem, G has a complete matching M from V1 to V2. Because |V1|=|V2|, Thus M is a perfect matching.

Exercise: P314 (Sixth) OR P (Fifth) 7,9,10,11,17,19, 20,21 NEXT Planar Graphs Exercise: P314 (Sixth) OR P (Fifth) 7,9,10,11,17,19, 20,21 1. Let G be a bipartite graph. Then G has a perfect matching iff |N(A)|≥|A| for AV.