MAXIMUM FLOW. introduction Ford-Fulkerson algorithm maxflow-mincut theorem

Similar documents
introduction Ford-Fulkerson algorithm

introduction Ford-Fulkerson algorithm

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Flow networks. Flow Networks. A flow on a network. Flow networks. The maximum-flow problem. Introduction to Algorithms, Lecture 22 December 5, 2001

Soviet Rail Network, 1955

1 Motivation and Basic Definitions

Max Flow, Min Cut COS 521. Kevin Wayne Fall Soviet Rail Network, Cuts. Minimum Cut Problem. Flow network.

Algorithm Design and Analysis

! Abstraction for material flowing through the edges. ! G = (V, E) = directed graph, no parallel edges.

CSE 521: Design & Analysis of Algorithms I

Greedy. I Divide and Conquer. I Dynamic Programming. I Network Flows. Network Flow. I Previous topics: design techniques

The Residual Graph. 11 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

Matching. Slides designed by Kevin Wayne.

The Residual Graph. 12 Augmenting Path Algorithms. Augmenting Path Algorithm. Augmenting Path Algorithm

Algorithm Design and Analysis

Maximum Flow and Minimum Cut

Today: Max Flow Proofs

Main Reference: Sections in CLRS.

CS 473G Lecture 15: Max-Flow Algorithms and Applications Fall 2005

4/12/12. Applications of the Maxflow Problem 7.5 Bipartite Matching. Bipartite Matching. Bipartite Matching. Bipartite matching: the flow network

Graphs III - Network Flow

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

Algorithmic Discrete Mathematics 6. Exercise Sheet

Soviet Rail Network, 1955

Randomized Perfect Bipartite Matching

Problem Set If all directed edges in a network have distinct capacities, then there is a unique maximum flow.

Reminder: Flow Networks

6/3/2009. CS 244 Algorithm Design Instructor: t Artur Czumaj. Lecture 8 Network flows. Maximum Flow and Minimum Cut. Minimum Cut Problem.

16 Max-Flow Algorithms and Applications

Flow Networks. Ma/CS 6a. Class 14: Flow Exercises

Network Flows: Introduction & Maximum Flow

Network Flow. Data Structures and Algorithms Andrei Bulatov

CSC 364S Notes University of Toronto, Spring, The networks we will consider are directed graphs, where each edge has associated with it

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Algorithms and Data Structures 2011/12 Week 9 Solutions (Tues 15th - Fri 18th Nov)

Maximum Flow. How do we transport the maximum amount data from source to sink? Some of these slides are adapted from Lecture Notes of Kevin Wayne.

Flow networks, flow, maximum flow. Some definitions. Edmonton. Saskatoon Winnipeg. Vancouver Regina. Calgary. 12/12 a.

Maximum Flow. Contents. Max Flow Network. Maximum Flow and Minimum Cut

18 Extensions of Maximum Flow

Algorithms 6.4 MAXIMUM FLOW. overview Ford-Fulkerson algorithm analysis Java implementation applications

CSE 421 Introduction to Algorithms Winter The Network Flow Problem

Basic Tools CMSC 641. Running Time. Problem. Problem. Algorithmic Design Paradigms. lg (n!) (lg n)! (lg n) lgn n.2

They were originally developed for network problem [Dantzig, Ford, Fulkerson 1956]

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Maximum Flow in Planar Graphs

3/3/2015. Chapter 7. Network Flow. Maximum Flow and Minimum Cut. Minimum Cut Problem

Network Flows UPCOPENCOURSEWARE number 34414

7. NETWORK FLOW I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 11/22/17 6:11 AM

Admin MAX FLOW APPLICATIONS. Flow graph/networks. Flow constraints 4/30/13. CS lunch today Grading. in-flow = out-flow for every vertex (except s, t)

Algorithms. Algorithms 6.4 MIN CUT / MAX FLOW

7. NETWORK FLOW I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 11/22/17 6:11 AM

Please Complete Course Survey. CMPSCI 311: Introduction to Algorithms. Approximation Algorithms. Coping With NP-Completeness. Greedy Vertex Cover

Today s topics. CSE 421 Algorithms. Problem Reduction Examples. Problem Reduction. Undirected Network Flow. Bipartite Matching. Problem Reductions

16 Max-Flow Algorithms

23 Maximum Flows and Minimum Cuts

CMPS 6610/4610 Fall Flow Networks. Carola Wenk Slides adapted from slides by Charles Leiserson

26.1 Flow networks. f (u,v) = 0.

7.5 Bipartite Matching. Chapter 7. Network Flow. Matching. Bipartite Matching

7.5 Bipartite Matching. Chapter 7. Network Flow. Matching. Bipartite Matching

April 3, The maximum flow problem. See class notes on website.

Wrap up: Weighted, directed graph shortest path Minimum Spanning Tree. Feb 25, 2019 CSCI211 - Sprenkle

Stationary Distribution. Design and Analysis of Algorithms Andrei Bulatov

Ford Fulkerson algorithm max-flow min-cut theorem. max-flow min-cut theorem capacity-scaling algorithm

7. NETWORK FLOW II. Soviet rail network (1950s) Max-flow and min-cut applications. "Free world" goal. Cut supplies (if cold war turns into real war).

Maximum Flow 5/6/17 21:08. Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015

Introduction to Congestion Games

DETC2004/CIE ALGORITHMIC FOUNDATIONS FOR CONSISTENCY-CHECKING OF INTERACTION-STATES OF MECHATRONIC SYSTEMS

Geometric Path Problems with Violations

EECE 301 Signals & Systems Prof. Mark Fowler

Selfish Routing. Tim Roughgarden Cornell University. Includes joint work with Éva Tardos

arxiv: v1 [cs.cg] 21 Mar 2013

, the. L and the L. x x. max. i n. It is easy to show that these two norms satisfy the following relation: x x n x = (17.3) max

Introduction to SLE Lecture Notes

20/20 20/20 0/5 0/5 20/20 20/20 5/5 0/5 0/5 5/5 0/20 25/30 20/20 30/30 20/20 0/5 5/5 20/20 0/5 0/5 15/20 15/25 20/20 10/10

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

Network Flow Applications

CHAPTER 7: SECOND-ORDER CIRCUITS

Graph Theory: Network Flow

Average Case Lower Bounds for Monotone Switching Networks

Maximum Flow 3/3 4/6 1/1 4/7 3/3. s 3/5 1/9 1/1 3/5 2/2. 1/18/2005 4:03 AM Maximum Flow 1

Lecture 26. Lucas and Stokey: Optimal Monetary and Fiscal Policy in an Economy without Capital (JME 1983) t t

Bipartite Matching. Matching. Bipartite Matching. Maxflow Formulation

Network flows. The problem. c : V V! R + 0 [ f+1g. flow network G = (V, E, c), a source s and a sink t uv not in E implies c(u, v) = 0

Price of Stability and Introduction to Mechanism Design

2. VECTORS. R Vectors are denoted by bold-face characters such as R, V, etc. The magnitude of a vector, such as R, is denoted as R, R, V

Notes on cointegration of real interest rates and real exchange rates. ρ (2)

Macroeconomics 1. Ali Shourideh. Final Exam

Random Walk with Anti-Correlated Steps

18.03SC Unit 3 Practice Exam and Solutions

Warm Up. Correct order: s,u,v,y,x,w,t

Ford-Fulkerson Algorithm for Maximum Flow

7. NETWORK FLOW II. Minimum cut application (RAND 1950s) Maximum flow application (Tolstoǐ 1930s) Max-flow and min-cut applications

The Primal Simplex Approach to the QoS Routing Problem

Today. Flow review. Augmenting paths. Ford-Fulkerson Algorithm. Intro to cuts (reason: prove correctness)

Dynamic Programming 11/8/2009. Weighted Interval Scheduling. Weighted Interval Scheduling. Unweighted Interval Scheduling: Review

Laplace Transform. Inverse Laplace Transform. e st f(t)dt. (2)

ARTIFICIAL INTELLIGENCE. Markov decision processes

Notes for Lecture 17-18

Inventory Analysis and Management. Multi-Period Stochastic Models: Optimality of (s, S) Policy for K-Convex Objective Functions

CS261: A Second Course in Algorithms Lecture #1: Course Goals and Introduction to Maximum Flow

Transcription:

MAXIMUM FLOW inroducion Ford-Fulkeron algorihm maxflow-mincu heorem

Mincu problem Inpu. An edge-weighed digraph, ource verex, and arge verex. each edge ha a poiive capaciy capaciy 9 10 4 15 15 10 5 8 10 15 4 6 15 10 16 2

Mincu problem Def. A -cu (cu) i a pariion of he verice ino wo dijoin e, wih in one e A and in he oher e B. Def. I capaciy i he um of he capaciie of he edge from A o B. 10 5 15 capaciy = 10 + 5 + 15 4

Mincu problem Def. A -cu (cu) i a pariion of he verice ino wo dijoin e, wih in one e A and in he oher e B. Def. I capaciy i he um of he capaciie of he edge from A o B. 10 8 don' coun edge from B o A capaciy = 10 + 8 + 16 16 5

Mincu problem Def. A -cu (cu) i a pariion of he verice ino wo dijoin e, wih in one e A and in he oher e B. Def. I capaciy i he um of he capaciie of he edge from A o B. Minimum -cu (mincu) problem. Find a cu of minimum capaciy. 10 8 10 capaciy = 10 + 8 + 10 = 28 6

Maxflow problem Inpu. An edge-weighed digraph, ource verex, and arge verex. each edge ha a poiive capaciy capaciy 9 4 15 5 8 10 4 15 16 9

Maxflow problem Def. An -flow (flow) i an aignmen of value o he edge uch ha: Capaciy conrain: 0 edge' flow edge' capaciy. Local equilibrium: inflow = ouflow a every verex (excep and ). flow capaciy 5 / 9 inflow a v = 5 + 5 + 0 = 10 ouflow a v = 10 + 0 = 10 5 / 5 5 / 8 10 / 10 10 / 16 7

Maxflow problem Def. An -flow (flow) i an aignmen of value o he edge uch ha: Capaciy conrain: 0 edge' flow edge' capaciy. Local equilibrium: inflow = ouflow a every verex (excep and ). Def. The value of a flow i he inflow a. we aume no edge poin o or from 5 / 9 5 / 5 5 / 8 10 / 10 value = 5 + 10 + 10 = 25 10 / 16 8

Maxflow problem Def. An -flow (flow) i an aignmen of value o he edge uch ha: Capaciy conrain: 0 edge' flow edge' capaciy. Local equilibrium: inflow = ouflow a every verex (excep and ). Def. The value of a flow i he inflow a. Maximum -flow (maxflow) problem. Find a flow of maximum value. 8 / 9 5 / 5 8 / 8 10 / 10 value = 8 + 10 + 10 = 28 13 / 16 9

Summary Inpu. A weighed digraph, ource verex, and arge verex. Mincu problem. Find a cu of minimum capaciy. Maxflow problem. Find a flow of maximum value. 8 / 9 10 5 / 5 8 / 8 10 / 10 8 10 13 / 16 value of flow = 28 capaciy of cu = 28 Remarkable fac. Thee wo problem are dual! 15

Ford-Fulkeron algorihm Iniializaion. Sar wih 0 flow. iniializaion flow capaciy 0 / 9 value of flow 0 / 5 0 / 8 0 / 10 0 0 / 16 11

Idea: increae flow along augmening pah Augmening pah. Find an undireced pah from o uch ha: Can increae flow on forward edge (no full). Can decreae flow on backward edge (no empy). 1 augmening pah 0 / 9 boleneck capaciy = 10 10 0 / 5 0 / 8 0 / 10 0 + 10 = 10 0 / 16 12

Idea: increae flow along augmening pah Augmening pah. Find an undireced pah from o uch ha: Can increae flow on forward edge (no full). Can decreae flow on backward edge (no empy). 2 nd augmening pah 0 / 9 0 / 5 0 / 8 10 / 10 10 + 10 = 20 10 0 / 16 13

Idea: increae flow along augmening pah Augmening pah. Find an undireced pah from o uch ha: Can increae flow on forward edge (no full). Can decreae flow on backward edge (no empy). 3 rd augmening pah 5 0 / 9 backward edge (no empy) 5 5 0 / 5 0 / 8 10 / 10 20 + 5 = 25 10 / 16 20

Idea: increae flow along augmening pah Augmening pah. Find an undireced pah from o uch ha: Can increae flow on forward edge (no full). Can decreae flow on backward edge (no empy). 4 h augmening pah 8 5 / 9 backward edge (no empy) 5 / 5 8 5 / 8 10 / 10 25 + 3 = 28 13 1 0 10 / 16 15

Idea: increae flow along augmening pah Terminaion. All pah from o are blocked by eiher a Full forward edge. Empy backward edge. no more augmening pah 8 / 9 5 / 5 8 / 8 10 / 10 28 13 / 16 full forward edge empy backward edge 16

Ford-Fulkeron algorihm Ford- Fulkeron algorihm Sar wih 0 flow. While here exi an augmening pah: - find an augmening pah - compue boleneck capaciy - increae flow on ha pah by boleneck capaciy Queion. How o compue a mincu? How o find an augmening pah? If FF erminae, doe i alway compue a maxflow? Doe FF alway erminae? If o, afer how many augmenaion? 17

Relaionhip beween flow and cu Def. The ne flow acro a cu (A, B) i he um of he flow on i edge from A o B minu he um of he flow on i edge from B o A. ne flow acro cu = 5 + 10 + 10 = 25 5 / 9 5 / 5 5 / 8 10 / 10 value of flow = 25 10 / 16 18

Relaionhip beween flow and cu Def. The ne flow acro a cu (A, B) i he um of he flow on i edge from A o B minu he um of he flow on i edge from B o A. ne flow acro cu = 10 + 5 + 10 = 25 5 / 9 5 / 5 5 / 8 10 / 10 value of flow = 25 10 / 16 19

Relaionhip beween flow and cu Def. The ne flow acro a cu (A, B) i he um of he flow on i edge from A o B minu he um of he flow on i edge from B o A. ne flow acro cu = (10 + 10 + 5 + 10 + 0 + 0) (5 + 5 + 0 + 0) = 25 5 / 9 edge from B o A 5 / 5 5 / 8 10 / 10 value of flow = 25 10 / 16 20

Relaionhip beween flow and cu Flow-value lemma. Le f be any flow and le (A, B) be any cu. Then, he ne flow acro (A, B) equal he value of f. Inuiion. Conervaion of flow. Pf. By inducion on he ize of B. Bae cae: B = { }. Inducion ep: remain rue by local equilibrium when moving any verex from A o B. Corollary. Ouflow from = inflow o = value of flow. 21

Relaionhip beween flow and cu Weak dualiy. Le f be any flow and le (A, B) be any cu. Then, he value of he flow he capaciy of he cu. Pf. Value of flow f = ne flow acro cu (A, B) capaciy of cu (A, B). flow-value lemma flow bounded by capaciy 8 / 9 10 5 / 5 7 / 8 9 / 10 5 15 12 / 16 value of flow = 27 capaciy of cu = 30 22

Maxflow-mincu heorem Augmening pah heorem. A flow f i a maxflow iff no augmening pah. Maxflow-mincu heorem. Value of he maxflow = capaciy of mincu. Pf. The following hree condiion are equivalen for any flow f : i. There exi a cu whoe capaciy equal he value of he flow f. ii. f i a maxflow. iii. There i no augmening pah wih repec o f. [ i ii ] Suppoe ha (A, B) i a cu wih capaciy equal o he value of f. Then, he value of any flow f ' capaciy of (A, B) = value of f. Thu, f i a maxflow. weak dualiy by aumpion 30

Maxflow-mincu heorem Augmening pah heorem. A flow f i a maxflow iff no augmening pah. Maxflow-mincu heorem. Value of he maxflow = capaciy of mincu. Pf. The following hree condiion are equivalen for any flow f : i. There exi a cu whoe capaciy equal he value of he flow f. ii. f i a maxflow. iii. There i no augmening pah wih repec o f. [ ii iii ] We prove conrapoiive: ~iii ~ii. Suppoe ha here i an augmening pah wih repec o f. Can improve flow f by ending flow along hi pah. Thu, f i no a maxflow. 24

Maxflow-mincu heorem Augmening pah heorem. A flow f i a maxflow iff no augmening pah. Maxflow-mincu heorem. Value of he maxflow = capaciy of mincu. Pf. The following hree condiion are equivalen for any flow f : i. There exi a cu whoe capaciy equal he value of he flow f. ii. f i a maxflow. iii. There i no augmening pah wih repec o f. [ iii i ] Suppoe ha here i no augmening pah wih repec o f. Le (A, B) be a cu where A i he e of verice conneced o by an undireced pah wih no full forward or empy backward edge. By definiion of cu, i in A. Since no augmening pah, i in B. Capaciy of cu = ne flow acro cu = value of flow f. forward edge full; backward edge empy flow-value lemma 25

Compuing a mincu from a maxflow To compue mincu (A, B) from maxflow f : By augmening pah heorem, no augmening pah wih repec o f. Compue A = e of verice conneced o by an undireced pah wih no full forward or empy backward edge. 8 / 9 5 / 5 8 / 8 10 / 10 A 3 / 4 forward edge (no full) 16 / 16 full forward edge empy backward edge backward edge (no empy) 33

How o chooe augmening pah? Ue care when elecing augmening pah. Some choice lead o exponenial algorihm. Clever choice lead o polynomial algorihm. augmening pah number of pah implemenaion random pah E U randomized queue DFS pah E U ack (DFS) hore pah ½ E V queue (BFS) fae pah E ln(e U) prioriy queue digraph wih V verice, E edge, and ineger capaciie beween 1 and U 27

How o chooe augmening pah? Chooe augmening pah wih: Shore pah: fewe number of edge. Fae pah: max boleneck capaciy. Edmond- Karp 1972 (USA) Dinic 1970 (Sovie Union) 28

Flow nework repreenaion Flow edge daa ype. Aociae flow fe and capaciy ce wih edge e = v w. flow fe capaciy ce 7 / 9 Flow nework daa ype. Mu be able o proce edge e = v w in eiher direcion: include e in adjacency li of boh v and w. Reidual (pare) capaciy. Forward edge: reidual capaciy = ce fe. Backward edge: reidual capaciy = fe. Augmen flow. Forward edge: add. Backward edge: ubrac. reidual capaciy 2 7 forward edge backward edge 4

Flow nework repreenaion Reidual nework. A ueful view of a flow nework. include all edge wih poiive reidual capaciy original nework 9 / 9 4 / 4 4 / 5 0 / 8 4 / 10 reidual nework 9 backward edge (no empy) 4 15 1 8 6 4 4 Key poin. Augmening pah in original nework are in 1-1 correpondence wih direced pah in reidual nework. forward edge (no full) 5

Flow edge API public cla FlowEdge FlowEdge(in v, in w, double capaciy) in from() in o() in oher(in v) creae a flow edge v w verex hi edge poin from verex hi edge poin o oher endpoin double capaciy() capaciy of hi edge double flow() double reidualcapaciyto(in v) void addreidualflowto(in v, double dela) flow in hi edge reidual capaciy oward v add dela flow oward v flow fe capaciy ce reidual capaciy forward edge 2 7 / 9 7 backward edge 31

Flow edge: Java implemenaion public cla FlowEdge { privae final in v, w; privae final double capaciy; privae double flow; public FlowEdge(in v, in w, double { hi.v = v; hi.w = w; hi.capaciy = capaciy; } // from and o // capaciy // flow capaciy) flow variable (muable) public public public public in from() in o() double capaciy() double flow() { reurn { reurn { reurn { reurn v; } w; } capaciy; } flow; } public in oher(in verex) { if (verex == v) reurn w; ele if (verex == w) reurn v; ele hrow new IllegalArgumenExcepion(); } } public double reidualcapaciyto(in verex) public void addreidualflowto(in verex, double dela) {...} {...} nex lide 32

Flow edge: Java implemenaion (coninued) public double reidualcapaciyto(in verex) { if (verex == v) reurn flow; ele if (verex == w) reurn capaciy - flow; ele hrow new IllegalArgumenExcepion(); } forward edge backward edge public void addreidualflowto(in verex, double dela) { if (verex == v) flow -= dela; ele if (verex == w) flow += dela; ele hrow new IllegalArgumenExcepion(); } forward edge backward edge flow fe capaciy ce reidual capaciy forward edge 2 7 / 9 7 backward edge 33

Flow nework API public cla FlowNework void Ierable<FlowEdge> FlowNework(in V) FlowNework(In in) addedge(flowedge e) adj(in v) creae an empy flow nework wih V verice conruc flow nework inpu ream add flow edge e o hi flow nework forward and backward edge inciden o v Ierable<FlowEdge> edge() in V() in E() Sring osring() all edge in hi flow nework number of verice number of edge ring repreenaion Convenion. Allow elf-loop and parallel edge. 34

Flow nework: Java implemenaion public cla FlowNework { privae final in V; privae Bag<FlowEdge>[] adj; ame a EdgeWeighedGraph, bu adjacency li of FlowEdge inead of Edge public FlowNework(in V) { hi.v = V; adj = (Bag<FlowEdge>[]) new for (in v = 0; v < V; v++) } Bag[V]; adj[v] = new Bag<FlowEdge>(); public void addedge(flowedge e) { } in in v = e.from(); w = e.o(); adj[v].add(e); adj[w].add(e); add forward edge add backward edge } public Ierable<FlowEdge> { reurn adj[v]; } adj(in v) 35

Flow nework: adjacency-li repreenaion Mainain verex-indexed array of FlowEdge li (ue Bag abracion). inyfn.x V 6 E 8 0 1 2.0 0 2 3.0 1 3 3.0 1 4 1.0 2 3 1.0 2 4 1.0 3 5 2.0 4 5 3.0 adj[] 0 1 2 3 4 5 0 2 3.0 1.0 0 1 2.0 2.0 reference o he ame FlowEdge objec 1 4 1.0 0.0 1 3 3.0 2.0 0 1 2.0 2.0 2 4 1.0 1.0 2 3 1.0 0.0 0 2 3.0 1.0 3 5 2.0 2.0 2 3 1.0 0.0 1 3 3.0 2.0 4 5 3.0 1.0 2 4 1.0 1.0 1 4 1.0 0.0 4 5 3.0 1.0 3 5 2.0 2.0 Bag objec Noe. Adjacency li include edge wih 0 reidual capaciy. (reidual nework i repreened implicily) 36

Finding a hore augmening pah (cf. breadh-fir earch) privae boolean haaugmeningpah(flownework G, { edgeto = new FlowEdge[G.V()]; marked = new boolean[g.v()]; in, in ) Queue<Ineger> queue = new Queue<Ineger>(); queue.enqueue(); marked[] = rue; while (!queue.iempy()) { in v = queue.dequeue(); } for (FlowEdge e : G.adj(v)) found pah from o w { in he reidual nework? in w = e.oher(v); if (!marked[w] && (e.reidualcapaciyto(w) > 0) ) { edgeto[w] = e; ave la edge on pah o marked[w] = rue; w; mark w; queue.enqueue(w); add w o he queue } } } reurn marked[]; i reachable from in reidual nework? 37

Ford-Fulkeron: Java implemenaion public cla FordFulkeron { privae boolean[] marked; // rue if ->v pah in reidual nework priva FlowEdge[] // la edge on ->v e edgeto; double // pah value of flow priva value; e public FordFulkeron(FlowNework G, in, in ) { value = 0.0; compue edgeto[] while (haaugmeningpah(g,, )) { compue boleneck capaciy double bole = Double.POSITIVE_INFINITY; for (in v = ; v!= ; v = edgeto[v].oher(v)) bole = Mah.min(bole, edgeto[v].reidualcapaciyto(v)); for (in v = ; v!= ; v = edgeto[v].oher(v)) edgeto[v].addreidualflowto(v, bole); } } value += bole; augmen flow privae boolean haaugmeningpah(flownework G, in, { /* See previou lide. */ } in ) } public double value() { reurn value; } public boolean incu(in v) { reurn marked[v]; } i v reachable from in reidual nework? 38

Biparie maching problem N uden apply for N job. biparie maching problem I here a way o mach all uden o job? Each ge everal offer. 1 Alice Adobe Amazon Google 2 Bob Adobe Amazon 3 Carol Adobe Faceboo k Google 4 Dave Amazon Yahoo 5 Eliza Amazon Yahoo 6 Ado be Alice Bob Carol 7 Amazon Alice Bob Dave Eliza 8 Facebook Carol 9 Google Alice Caro l 10 Yahoo Dave Eliza 39

Biparie maching problem Given a biparie graph, find a perfec maching. perfec maching (oluion) biparie graph biparie maching problem Alice Bob Caro l Dave Eliza Google Adobe Facebook Yahoo Amazon 3 1 2 4 5 6 7 8 9 10 1 Alice Adobe Amazon Google 2 Bob Adobe Amazon 3 Carol Adobe Faceboo k Google 4 Dave Amazon Yahoo 6 Ado be Alice Bob Carol 7 Amazon Alice Bob Dave Eliza 8 Facebook Carol 9 Google Alice Caro l N uden N companie 5 Eliza Amazon Yahoo 10 Yahoo Dave Eliza 40

Nework flow formulaion of biparie maching Creae,, one verex for each uden, and one verex for each job. Add edge from o each uden (capaciy 1). Add edge from each job o (capaciy 1). Add edge from uden o each job offered (infinie capaciy). flow nework biparie maching problem 1 6 2 7 3 8 4 9 5 10 N uden N companie 1 Alice Adobe Amazon Google 2 Bob Adobe Amazon 3 Carol Adobe Faceboo k Google 4 Dave Amazon Yahoo 5 Eliza Amazon Yahoo 6 Ado be Alice Bob Carol 7 Amazon Alice Bob Dave Eliza 8 Facebook Carol 9 Google Alice Caro l 10 Yahoo Dave Eliza 41

Nework flow formulaion of biparie maching 1-1 correpondence beween perfec maching in biparie graph and ineger-valued maxflow of value N. flow nework biparie maching problem 1 2 3 4 5 6 7 8 9 10 1 Alice Adobe Amazon Google 2 Bob Adobe Amazon 3 Carol Adobe Faceboo k Google 4 Dave Amazon Yahoo 6 Ado be Alice Bob Carol 7 Amazon Alice Bob Dave Eliza 8 Facebook Carol 9 Google Alice Caro l N uden N companie 5 Eliza Amazon Yahoo 10 Yahoo Dave Eliza 42

Wha he mincu ell u Goal. When no perfec maching, explain why. 1 6 2 3 4 5 7 8 9 10 S = { 2, 4, 5 } T = { 7, 10 } uden in S can be mached only o companie in T S > T no perfec maching exi 43

Wha he mincu ell u Mincu. Conider mincu (A, B). Le S = uden on ide of cu. Le T = companie on ide of cu. Fac: S > T ; uden in S can be mached only o companie in T. 1 6 2 7 S = { 2, 4, 5 } 3 8 T = { 7, 10 } uden in S can be mached only o 4 9 companie in T S > T 5 10 no perfec maching exi Boom line. When no perfec maching, mincu explain why. 44