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

Similar documents
Graphs III - Network Flow

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

1 Motivation and Basic Definitions

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

Maximum Flow and Minimum Cut

Network Flows: Introduction & Maximum Flow

Today: Max Flow Proofs

Soviet Rail Network, 1955

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

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

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

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

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

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

Algorithm Design and Analysis

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

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

Soviet Rail Network, 1955

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

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

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)

Main Reference: Sections in CLRS.

Flow Networks Alon Efrat Slides courtesy of Charles Leiserson with small changes by Carola Wenk. Flow networks. Flow networks CS 445

Algorithm Design and Analysis

Network Flow. Data Structures and Algorithms Andrei Bulatov

Matching. Slides designed by Kevin Wayne.

CSE 521: Design & Analysis of Algorithms I

Algorithmic Discrete Mathematics 6. Exercise Sheet

Randomized Perfect Bipartite Matching

18 Extensions of Maximum Flow

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

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.

Network Flows UPCOPENCOURSEWARE number 34414

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

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

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

CSE 421 Introduction to Algorithms Winter The Network Flow Problem

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

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

Reminder: Flow Networks

16 Max-Flow Algorithms and Applications

Algorithms. Algorithms 6.4 MAXIMUM FLOW

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

Introduction to Congestion Games

Introduction to SLE Lecture Notes

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

23 Maximum Flows and Minimum Cuts

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

, 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

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

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

Math 2142 Exam 1 Review Problems. x 2 + f (0) 3! for the 3rd Taylor polynomial at x = 0. To calculate the various quantities:

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

EECE 301 Signals & Systems Prof. Mark Fowler

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

Notes for Lecture 17-18

16 Max-Flow Algorithms

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

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

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

introduction Ford-Fulkerson algorithm

introduction Ford-Fulkerson algorithm

Finish reading Chapter 2 of Spivak, rereading earlier sections as necessary. handout and fill in some missing details!

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

CS Lunch This Week. Special Talk This Week. Soviet Rail Network, Flow Networks. Slides20 - Network Flow Intro.key - December 5, 2016

NECESSARY AND SUFFICIENT CONDITIONS FOR LATENT SEPARABILITY

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

arxiv: v1 [cs.cg] 21 Mar 2013

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

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

Some Ramsey results for the n-cube

Graph Theory: Network Flow

We just finished the Erdős-Stone Theorem, and ex(n, F ) (1 1/(χ(F ) 1)) ( n

1 Solutions to selected problems

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

Maximum Flow. Flow Graph

Question 1: Question 2: Topology Exercise Sheet 3

23.2. Representing Periodic Functions by Fourier Series. Introduction. Prerequisites. Learning Outcomes

Maximum Flow in Planar Graphs

Bipartite Matching. Matching. Bipartite Matching. Maxflow Formulation

Generalized Orlicz Spaces and Wasserstein Distances for Convex-Concave Scale Functions

u(t) Figure 1. Open loop control system

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

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

Topics in Combinatorial Optimization May 11, Lecture 22

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

Challenge Problems. DIS 203 and 210. March 6, (e 2) k. k(k + 2). k=1. f(x) = k(k + 2) = 1 x k

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

FLAT CYCLOTOMIC POLYNOMIALS OF ORDER FOUR AND HIGHER

Journal of Discrete Algorithms. Approximability of partitioning graphs with supply and demand

5.1 - Logarithms and Their Properties

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

CHAPTER 7. Definition and Properties. of Laplace Transforms

s-domain Circuit Analysis

Stationary Distribution. Design and Analysis of Algorithms Andrei Bulatov

Let. x y. denote a bivariate time series with zero mean.

CHAPTER 7: SECOND-ORDER CIRCUITS

Monochromatic Infinite Sumsets

Chapter 2. First Order Scalar Equations

Physics 240: Worksheet 16 Name

Transcription:

CS 545 Flow Nework lon Efra Slide courey of Charle Leieron wih mall change by Carola Wenk Flow nework Definiion. flow nework i a direced graph G = (V, E) wih wo diinguihed verice: a ource and a ink. Each edge (u, E ha a nonnegaive capaciy c(u,. If (u, E, hen c(u, = 0. Example: Flow nework Definiion. poiive flow on G i a funcion p : V V Raifying he following: Capaciy conrain: For all u, v V, 0 p(u, c(u,. Flow conervaion: For all u V {, }, p ( u, p( u) = 0. The value of a flow i he ne flow ou of he ource: p (, p( ). poiive flow flow on a nework : capaciy : 0: u : : : : : : : : Flow conervaion Flow ino u i + =. Flow ou of u i 0 + + =. The value of hi flow i 0 + =. The maximum-flow problem Maximum-flow problem: Given a flow nework G, find a flow of maximum value on G. : : 0: 0: : : : : : : : The value of he maximum flow i 4. pplicaion: Biparie Maching. B graph G(V,E) i called biparie if V can be pariioned ino wo e V= B, and each edge of E connec a verex of o a verex of B. maching i a e of edge M of E, where each verex of i adjacen o a mo one verex of B

Maching and flow problem : : 0: : B dd a verex, and connec i o each verex of. dd a verex, and connec each verex of B o. The capaciy of all edge i. Find max flow. ume i i an ineger flow, o he flow of each edge i eiher 0 or. Each edge of G ha carrie flow i in he maching. Each edge of G ha doe no carry flow i no in he maching. Claim: The edge beween and B ha carry flow form a maching. Greedy i ubopimal. : : : 0: 0: 0: 0: B ume we have already ome edge in a (parial ) maching M. In order o increae he cardinaliy of he maching we migh need o fir remove from M ome edge (omehow counerinuiive?) Thinking again abou he maching a flow problem, i mean ha we migh need o remove flow from edge ha currenly curry flow. Flow cancellaion Wihou lo of generaliy, poiive flow goe eiher from u o or from v o u, bu no boh. : : : 0: Ne flow from u o v in boh cae i. The capaciy conrain and flow conervaion are preerved by hi ranformaion. noaional implificaion IDE: Work wih he ne flow beween wo verice, raher han wih he poiive flow. Definiion. (ne) flow on G i a funcion f : V V Raifying he following: Capaciy conrain: For all u, v V, f (u, c(u,. Flow conervaion: For all u V {, }, f ( u, = 0. One ummaion inead of wo. Skew ymmery: For all u, v V, f (u, = f ( u). Equivalence of definiion Ne flow v. poiive flow. Theorem. The wo definiion are equivalen. Proof. ( ) Le f (u, = p(u, p( u). Capaciy conrain: Since p(u, c(u, and p( u) 0, we have f (u, c(u,. Flow conervaion: f ( u, = ( p( u, p( u) ) = p( u, p( u) In paricular, if u V {, }, hen f ( u, =0 Skew ymmery: f (u, = p(u, p( u) = (p( u) p(u, ) = f ( u). Proof (coninued) Obaining he poiive flow from he ne flow ( ) Define p(u, = f (u, if f(u, > 0, 0 if f(u, 0. Capaciy conrain: By definiion, p(u, 0. Since f (u, c(u,, i follow ha p(u, c(u,. Flow conervaion: If f (u, > 0, hen f ( u) < 0 o p(u)=0. p(u, p( u) = f (u,. If f (u, 0, hen p(u, p( u) = f ( u) = f (u, by kew ymmery. Therefore, p ( u, p( u) = f ( u,

Reidual nework Definiion. Le f be a flow on G = (V, E). The reidual nework G f (V, E f ) i he graph wih ricly poiive reidual capaciie c f (u, = c(u, f (u, > 0. Example: 4 0:4 Lemma. E f E. 4 4:4 :4 ugmening pah Definiion. ny pah from o in G f i an augmening pah in G wih repec o f. The flow value can be increaed along an augmening pah p by adding. c f (p):=min{ c f (u, (u, p } o he ne flow of each edge along p. (u, p e f(u, += c f (p) ; f(u) -= c f (p) Thi i called pah augmenaion. Example: :5 :6 7: c f (p) = 5:5 4 4:6 5 7 : Noe flow conervaion i preerved. ugmening pah anoher example Definiion. ny pah from o in G f i an augmening pah in G wih repec o f. The flow value can be increaed along an augmening pah p by adding c f (p):=min{ c f (u, (u, on p } o he ne flow of each edge along p. Thi i called pah augmenaion. Example : :5 :6-5: :5 5:5 : c f (p) = 5:5 4 4:6 -: 7 4:5 :5 0: Example maximum maching G : : 0: B. : : 0: 0: 0: B. f =0 Ford-Fulkeron max-flow algorihm Sar: While () { conruc G f if an augmening pah p in G f exi hen augmen f by c f (p) //ny pah would do ele exi } 0:0 0:0 0: 0:0 0:0 :0 0:0 c f (p)= 0 0 : 0:0 :0 0 f = 0 0 0 c f (p)= 0 0 8 8 :0 :0 :0 0: f = :0 :0 :0 :0 : :0 f = :0 :0 :0 0: f =4 :0

noher example - Maching : : : G : 0: 0: 0: 0: B. B. 0: : : G : : : : : f = f = Noaion Definiion. The value of a flow f, denoed by f, i given by f f (, = = f (, V ). Implici ummaion noaion: e ued in an arihmeic formula repreen a um over he elemen of he e. Example flow conervaion: f (u, V) = f(u, = 0 for all u V {, }. More definiion f (X, Y) = u X v Y f(u, Lemma: More properie of flow. If X doe no conain nor, hen f (X, V) = 0 Proof: f (X, V) = u X f(u,v) = u X 0. X u V v Y. If,B are dijoin e of verice, and X i anoher e, hen f ( B, X) = f(,x) +f(b,x) X B Noe (propery *): f(,x) = f ( B, X) - f(b,x) nd more properie of flow Lemma ( Propery #): For every e X of verice f (X,X)=0 Proof: f(x,x)= u X v X f(u,, and if f(u, appear in he ummaion, hen f(u) alo appear in he ummaion, and f(u) = -f(u,. Simple properie of flow Recall: f =f(,v)= v X f(, Theorem. f = f (V, ). Proof. f = f (, V) = f (V, V) f (V, V) (Propery *) = f (V, V ) (Propery #) = f (V, ) + f (V, V ) (Cae ) = f (V, ). (Cae )

Flow ino he ink : : -: 0: : : : : -: : : f = f (, V) = 4 f (V, ) = 4 Cu Definiion. cu (S, T) of a flow nework G =(V, E) i a pariion of V uch ha S and T. If f i a flow on G, hen he flow acro he cu i f (S, T). : : -: 0: : : : : 0: S={,a} f (S, T) = ( + ) + ( + + ) = 4 a : : S T noher characerizaion of flow value Recall: f =f(,v)= f(, Lemma. For any flow f and any cu (S, T), we have f = f (S, T). Proof. f (S, T) = f (S, V) f (S, S) (propery *) = f (S, V) = f (, V) + f (S, V) = f (, V) = f. : Capaciy of a cu Definiion. The capaciy of a cu (S, T) i c(s, T) = u S v T c(u, : : : S 0: 0: : 0: T : : c(s, T) = ( + ) + ( + + ) = : Upper bound on he maximum flow value Theorem. The value of any flow no larger han he capaciy of any cu: f c(s,t). Max-flow, min-cu heorem Theorem. The following are equivalen:. f = c(s, T) for ome cu (S, T).. f i a maximum flow.. f admi no augmening pah. min-cu Proof. f = f ( S, T) = f ( u, u S v T u S v T = c( S, T ). c( u, Proof. () (): Since f c(s, T) for any cu (S, T) (by he heorem from a few lide back), he aumpion ha f = c(s, T) implie ha f i a maximum flow. () (): If here were an augmening pah, he flow value could be increaed, conradicing he maximaliy of f.

() (): Define S = {v V here exi a pah in G f from o v}, Le T = V S. Since f admi no augmening pah, here i no pah from o in G f. Hence, S and S, So Τ. Thu (S, T) i a cu. Conider any verice u S and v T. pah in G f S T Conider u S, v T. We mu have c f (u, = 0, ince if c f (u, > 0, hen v S, no v T a aumed. Thu, f (u, = c(u,, ince c f (u, = c(u, f (u,. Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G f wr f exi do augmen f by c f (p) Can be low: 0 0 0 0 Summing over all u S and v T yield f (S, T) = c(s, T), and ince f = f (S, T), he heorem follow. Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Can be low: 0:0 0:0 0: Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Can be low: 0:0 0:0 0: 0:0 0:0 0:0 0:0 Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Can be low: :0 0:0 : Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Can be low: :0 0:0 : 0:0 :0 0:0 :0

Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Can be low: :0 :0 0: Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Can be low: :0 :0 0: :0 :0 :0 :0 Ford-Fulkeron max-flow algorihm lgorihm: while an augmening pah p in G wr f exi do augmen f by c f (p) Runime: Le f* be he value of a maximum flow, and aume i i an inegral value. The iniializaion ake O( E ) There are a mo f* ieraion of he loop Find an augmening pah wih DFS in O( V + E ) ime Each augmenaion ake O( V ) ime O( E f* ) in oal Ford-Fulkeron and maching Recall we expreed he maximum maching problem a a nework flow, bu we can expre he max flow a a maching, only if he flow i an ineger flow. However, hi i alway he cae once uing F&F algorihm: The flow along each edge i eiher 0 or. G : : 0: 0: 0: 0: B :. Runime analyi of F&F-algorihm applied for maching We aw ha in each ieraion of F&F algorihm, f increae by a lea. Le f* be he maximum value. How large can f* be? Claim: f* min{, B } (why?) Runime i O( E min{, B } )=O( E V ) Can be done in O( E / V ) (Dinic lgorihm) Edmond-Karp algorihm Edmond and Karp noiced ha many people implemenaion of Ford-Fulkeron augmen along a breadh-fir augmening pah: a pah wih malle number of edge in G f from o. Thee implemenaion would alway run relaively fa. Since a breadh-fir augmening pah can be found in O( E ) ime, heir analyi, focue on bounding he number of flow augmenaion. (In independen work, Dinic alo gave polynomial-ime bound.)

Running ime of Edmond-Karp One can how ha he number of flow augmenaion (i.e., he number of ieraion of he while loop) i O( V E ). Breadh-fir earch run in O( E ) ime ll oher bookkeeping i O( V ) per augmenaion. The Edmond-Karp maximum-flow algorihm run in O( V E ) ime. Be o dae The aympoically fae algorihm o dae for maximum flow, due o King, Rao, and Tarjan, run in O(V E log E/(V lg V) V) ime. If we allow running ime a a funcion of edge weigh, he fae algorihm for maximum flow, due o Goldberg and Rao, run in ime O(min{V /, E / } E lg (V /E + ) lg C), where C i he maximum capaciy of any edge in he graph.