Graduate Algorithms CS F-18 Flow Networks

Similar documents
Maximum Flow. Flow Graph

CSC 373: Algorithm Design and Analysis Lecture 9

Solutions to assignment 3

1 The Network Flow Problem

Lecture 2: Network Flow. c 14

CS3510 Design & Analysis of Algorithms Fall 2017 Section A. Test 3 Solutions. Instructor: Richard Peng In class, Wednesday, Nov 15, 2017

Bipartite Matching. Matching. Bipartite Matching. Maxflow Formulation

Graphs III - Network Flow

Jonathan Turner Exam 2-10/28/03

ALG 5.3 Flow Algorithms:

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

5. Network flow. Network flow. Maximum flow problem. Ford-Fulkerson algorithm. Min-cost flow. Network flow 5-1

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

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

Network Flows: Introduction & Maximum Flow

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

LAPLACE TRANSFORMS. 1. Basic transforms

A LOG IS AN EXPONENT.

Released Assessment Questions, 2017 QUESTIONS

Minimum Squared Error

Chapter Introduction. 2. Linear Combinations [4.1]

Minimum Squared Error

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

Main Reference: Sections in CLRS.

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)

1 Motivation and Basic Definitions

4.8 Improper Integrals

Maximum Flow and Minimum Cut

Max-flow and min-cut

Max-flow and min-cut

Soviet Rail Network, 1955

Section P.1 Notes Page 1 Section P.1 Precalculus and Trigonometry Review

Today: Max Flow Proofs

Matching. Slides designed by Kevin Wayne.

The solution is often represented as a vector: 2xI + 4X2 + 2X3 + 4X4 + 2X5 = 4 2xI + 4X2 + 3X3 + 3X4 + 3X5 = 4. 3xI + 6X2 + 6X3 + 3X4 + 6X5 = 6.

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

Fall 2014 David Wagner 10/31 Notes. The min-cut problem. Examples

Algorithm Design and Analysis

Network Flow. Data Structures and Algorithms Andrei Bulatov

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

Positive and negative solutions of a boundary value problem for a

Algorithmic Discrete Mathematics 6. Exercise Sheet

Randomized Perfect Bipartite Matching

0 for t < 0 1 for t > 0

Sph3u Practice Unit Test: Kinematics (Solutions) LoRusso

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

e t dt e t dt = lim e t dt T (1 e T ) = 1

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

Algorithm Design and Analysis

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

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

CSE 521: Design & Analysis of Algorithms I

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

Motion. Part 2: Constant Acceleration. Acceleration. October Lab Physics. Ms. Levine 1. Acceleration. Acceleration. Units for Acceleration.

graph of unit step function t

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

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

PHYSICS Solving Equations

Factorising FACTORISING.

Reminder: Flow Networks

Maximum Flow in Planar Graphs

ENGR 1990 Engineering Mathematics The Integral of a Function as a Function

1. Consider a PSA initially at rest in the beginning of the left-hand end of a long ISS corridor. Assume xo = 0 on the left end of the ISS corridor.

And I Saw a New Heaven

Solutions for HW9. Bipartite: put the red vertices in V 1 and the black in V 2. Not bipartite!

18.06 Problem Set 4 Due Wednesday, Oct. 11, 2006 at 4:00 p.m. in 2-106

Solutions for Assignment 2

Physics Worksheet Lesson 4: Linear Motion Section: Name:

PHYSICS 1210 Exam 1 University of Wyoming 14 February points

Bisimulation, Games & Hennessy Milner logic p.1/32

( ) ( ) ( ) ( ) ( ) ( y )

Soviet Rail Network, 1955

8.1. a) For step response, M input is u ( t) Taking inverse Laplace transform. as α 0. Ideal response, K c. = Kc Mτ D + For ramp response, 8-1

ANSWERS TO EVEN NUMBERED EXERCISES IN CHAPTER 2

Mathcad Lecture #4 In-class Worksheet Vectors and Matrices 1 (Basics)

Transformations. Ordered set of numbers: (1,2,3,4) Example: (x,y,z) coordinates of pt in space. Vectors

S Radio transmission and network access Exercise 1-2

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

Section 5: Chain Rule

2D Motion WS. A horizontally launched projectile s initial vertical velocity is zero. Solve the following problems with this information.

EECE 301 Signals & Systems Prof. Mark Fowler

Surds and Indices. Surds and Indices. Curriculum Ready ACMNA: 233,

And I Saw a New Heaven

t s (half of the total time in the air) d?

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

Addition & Subtraction of Polynomials

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

18 Extensions of Maximum Flow

Some basic notation and terminology. Deterministic Finite Automata. COMP218: Decision, Computation and Language Note 1

CSE 332. Sorting. Data Abstractions. CSE 332: Data Abstractions. QuickSort Cutoff 1. Where We Are 2. Bounding The MAXIMUM Problem 4

Counting Paths Between Vertices. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs

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

Solving Evacuation Problems Efficiently. Earliest Arrival Flows with Multiple Sources

1.0 Electrical Systems

Homework 2 Solutions

Robust Network Coding for Bidirected Networks

Chapter 9 - The Laplace Transform

Contraction Mapping Principle Approach to Differential Equations

CS 170 DISCUSSION 10 MAXIMUM FLOW. Raymond Chan raychan3.github.io/cs170/fa17.html UC Berkeley Fall 17

Forms of Energy. Mass = Energy. Page 1. SPH4U: Introduction to Work. Work & Energy. Particle Physics:

Transcription:

Grue Algorihm CS673-2016F-18 Flow Nework Dvi Glle Deprmen of Compuer Siene Univeriy of Sn Frnio

18-0: Flow Nework Diree Grph G Eh ege weigh i piy Amoun of wer/eon h n flow hrough pipe, for inne Single oure S, ingle ink Clule mximum flow hrough grph

18-1: Flow Nework Flow: Funion: V V R Flow from eh verex o every oher verex f(u,v) i he ire flow from u o v Properie: u,v V,f(u,v) (u,v) u,v V,f(u,v) = f(v,u) u V {,}, v V f(u,v) = 0 Tol flow, f = v V f(,v) = v V f(v,)

18-2: Flow Nework Single Soure / Single Sink Aume h here i lwy ingle oure n ingle ink Don lo ny expreive power lwy rnform prolem wih muliple oure n muliple ink o n equivlen prolem wih ingle oure n ingle ink How?

18-3: Flow Nework Exmple: Shipping prou o wrehoue Prou proue fory, pu in re Cre re hippe o wrehoue To u own o, ue exr pe in oher people ruk How muh prou n e proue per y?

18-4: Flow Nework 16 Chigo 12 New York 20 L.A. 4 10 9 7 New Jerey 13 Dll 14 Piurgh 4

18-5: Flow Nework I woul e lile illy o hip 4 re from Dll o Chigo, n 7 re from Chigo o Dll Coul ju hip 3 re from Chigo o Dll ine We will ume h here i only every flow in one ireion Flow in he oppoie ireion nel ou

18-6: Flow Nework 11/16 Chigo 12/12 New York 15/20 L.A. 1/4 0/10 4/9 7/7 New Jerey 8/13 Dll I hi flow opiml? Piurgh 11/14 4/4

18-7: Flow Nework 11/16 Chigo 12/12 New York 19/20 L.A. 1/4 0/10 0/9 7/7 New Jerey 12/13 Dll Piurgh 11/14 4/4

18-8: Flow Nework Negive flow I i perfely legl for here o e negive flow from v o u Negive flow from v o u ju men h here i poiive flow from u o v Rell h he ol flow over ll ege inien o verex mu e zero, exep for oure & ink

18-9: Flow Nework Reiul piy f (u,v) i he reiul piy of ege (u,v) f (u,v) = (u,v) f(u,v) Noe h i i poile for he reiul piy of n ege o e greer hn he ol piy Cnelling flow in he oppoie ireion

18-10: Flow Nework Reiul Nework Given e of piie, n e of urren flow, we n ree reiul nework Reiul nework n hve ifferen ege hn he piy nework

18-11: Flow Nework 5 6 8 3 3 2 6 4 1 5

18-12: Flow Nework 3/5 0/3 3/6 2/8 1/3 2/2 0/6 1/4 0/1 2/5

18-13: Flow Nework 3/5 0/3 3/6 2/8 1/3 2/2 0/6 1/4 0/1 2/5 3 3 3 2 2 6 1 3 2 1 1 8 3 2

18-14: Flow Nework Given flow nework, wih ome flow lule Inue reiul nework There i ph from oure o ink in he reiul nework uh h: All reiul piie long he ph re > 0 How n we inree he ol flow?

18-15: Augmening Ph An Augmening ph in flow nework i ph hrough he nework uh h ll reiul piie long he ph > 0 Given flow nework n n ugmening ph, we n inree he ol flow y he mlle reiul piy long he ph Inree flow long ph y mlle reiul piy long he ph My involve ome flow nelling

18-16: Augmening Ph 3/5 0/3 3/6 2/8 1/3 2/2 0/6 1/4 0/1 2/5 3 3 3 2 2 3 6 1 3 2 1 1 8 3 2

18-17: Augmening Ph 3/5 0/3 3/6 2/8 1/3 2/2 0/6 1/4 0/1 2/5 3 3 3 2 2 3 6 1 3 2 1 1 8 3 2

18-18: Augmening Ph 4/5 0/3 4/6 2/8 0/3 2/2 0/6 1/4 1/1 3/5 4 4 2 2 1 6 1 3 3 0 0 1 8 2 3

18-19: Augmening Ph 4/5 0/3 4/6 2/8 0/3 2/2 0/6 1/4 1/1 3/5 4 4 2 2 1 1 3 3 3 1 8 6 2 3

18-20: For-Fulkeron Meho For-Fulkeron(G,, ) iniilize flow f o 0 while here i n ugmening ph p ugmen flow f long p reurn f

18-21: For-Fulkeron Meho Wh i he running ime of For-Fulkeron Meho? Fin n ugmening ph Upe flow / reiul Repe unil here re no more ugmening ph

18-22: For-Fulkeron Meho Wh i he running ime of For-Fulkeron Meho? Fin n ugmening ph Uing DFS, O( E ) Upe flow / reiul O( E ) Repe unil here re no more ugmening ph Eh ierion oul inree he flow y 1, oul hve f ierion! Tol: O( f E )

18-23: For-Fulkeron Meho Coul ke mny f ierion: 1000000 1000000 1 1000000 1000000

18-24: For-Fulkeron Meho Coul ke mny f ierion: Flow Nework Reiul Nework 0/1000000 0/1000000 1000000 1000000 0/1 1 0/1000000 0/1000000 1000000 1000000

18-25: For-Fulkeron Meho Coul ke mny f ierion: Flow Nework Reiul Nework 1/1000000 0/1000000 999999 1000000 1/1 1 0/1000000 1/1000000 1000000 999999

18-26: For-Fulkeron Meho Coul ke mny f ierion: Flow Nework Reiul Nework 1/1000000 0/1000000 999999 1000000 1/1 1 0/1000000 1/1000000 1000000 999999

18-27: For-Fulkeron Meho Coul ke mny f ierion: Flow Nework Reiul Nework 1/1000000 1/1000000 999999 999999 0/1 1 1/1000000 1/1000000 999999 999999

18-28: For-Fulkeron Meho How n we e mr ou hooing he ugmening ph, o voi he previou e?

18-29: Emon-Krp Algorihm How n we e mr ou hooing he ugmening ph, o voi he previou e? We n ge eer performne y lwy piking he hore ph (ph wih he fewe ege) We n quikly fin he hore ph y oing BFS from he oure in he reiul nework, o fin he hore ugmening ph If we lwy hooe he hore ugmening ph (i.e., mlle numer of ege), ol numer of ierion i O( V E ), for ol running ime of O( V E 2 )

18-30: Emon-Krp Algorihm If we lwy pik he hore ugmening ph, no more hn V E ierion: Lemm #1: Shore ph from oure o ny oher verex in reiul grph n only inree, no eree. Reiul grph hnge over ime ege re e n remove However, hore ph from oure o ny verex in he reiul grph will only inree over ime, never eree

18-31: Emon-Krp Algorihm Lemm #1: Shore ph from oure o ny oher verex in reiul grph n only inree, no eree. Proof y onriion Aume hore ph from oure o ome oher verex hnge fer n ugmenion Le f e he flow righ efore he hore ph eree, n f e he flow righ fer Le v e verex uh h δ f (,v) < δ f (,v). If here i more hn one uh v, pik he one wih he mlle δ f (,v) vlue Le p =... u v e he hore ph from o v in f

18-32: Emon-Krp Algorihm Lemm #1: Shore ph from oure o ny oher verex in reiul grph n only inree, no eree. Proof y onriion Ege (u,v) (l ege on ph from o v in G f ) mu no e in G f δ f (,u) δ f (,u) Beue δ f (,u) < δ f (,v), n we pike v o e he verex wih he mlle δ f (,v) vlue h hnge If (u,v) G f δ f (,v) δ f (,u)+1 δ f (,u)+1 δ f (,v)

18-33: Emon-Krp Algorihm Lemm #1: Shore ph from oure o ny oher verex in reiul grph n only inree, no eree. Proof y onriion Ege (u,v) mu e in G f u no in G f o he ugmening ph mu inlue (v,u) We lwy hooe hore ph our ugmening ph Shore ph from o u mu inlue (v,u) δ f (,v) = δ f (,u) 1 δ f (,u) 1 δ f (,v) 2

18-34: Emon-Krp Algorihm If we lwy pik he hore ugmening ph, no more hn V E ierion: An ege on n ugmening ph i riil if i i remove when he flow i ugmene (why mu here lwy e le one riil ege)? Eh ege n only e riil mo V /2 ime

18-35: Emon-Krp Algorihm Eh ege n only e riil mo V /2 ime When ege (u,v) i riil: δ f (,v) = δ f (,u)+1 Criil ege i remove efore i n eome riil gin, i mu e e k y ome ugmening ph h ph mu onin ege (u,v) Le f e he flow when he ege i e k. δ f (,u) = δ f (,v)+1 δ f (,v)+1 = δ f (,u)+1+1

18-36: Emon-Krp Algorihm Eh ege n only e riil mo V /2 ime Le f e he flow when he ege i e k. δ f (,u) = δ f (,v)+1 δ f (,v)+1 = δ f (,u)+1+1 If n ege (u,v) eome riil wie, he hore ph from o u mu inree y 2 Eh ege n only e riil V /2 ime

18-37: Emon-Krp Algorihm If we lwy pik he hore ugmening ph, no more hn V E ierion: An ege on n ugmening ph i riil if i i remove when he flow i ugmene (why mu here lwy e le one riil ege)? Eh ege n only e riil mo V /2 ime E ol ege no more hn E V /2 ierion

18-38: Mhing Prolem Given n uniree grph G = (V,E) mhing M i Sue of ege E For ny verex v V, mo one ege in M i inien o v Mximum mhing i mhing wih lrge poile numer of ege

18-39: Mhing Prolem Biprie grph Verie n e ivie ino wo group, S 1 n S 2 Eh ege onne verex in S 1 wih verex in S 2

18-40: Mhing Prolem

18-41: Mhing Prolem

18-42: Mhing Prolem

18-43: Mhing Prolem

18-44: Mhing Prolem Fining mhing in iprie grph n e oniere mximum flow prolem. How?

18-45: Mhing Prolem Fining mhing in iprie grph n e oniere mximum flow prolem. How?

18-46: Puh-Relel Algorihm New lgorihm for luling mximum flow Bi ie: Allow verie o e overfull (hve more inflow hn ouflow) Puh full piy ou of ege from oure Puh overflow eh verex forwr o he ink Puh exe flow k o oure

18-47: Puh-Relel Algorihm Think of grph unh of wer oniner onnee y pipe. We will rie n lower he verie, n llow wer o flow eween hem Wer n only flow from higher verex o lower verex Iniilly, oure i heigh V, ll oher verie re heigh 1 Full piy of eh pipe ou of he oure flow o eh verex jen o he oure

18-48: Puh-Relel Algorihm Full piy of eh pipe ou of he oure flow k o eh verex jen o he oure Thi ue ome verie o e overfull inflow greer hn ouflow Rie ome verex whoe inflow i greer hn ouflow, o llow wer o flow o ifferen verie Repe unil ll verie (oher hn he ink, whih y level 0) re he me level he oure If here re ill overfull verie, oninue o rie hem o h he exr flow pill k ino he oure

18-49: Puh-Relel Algorihm Heigh 4 3 5 3 2 6 6 5 1 2

18-50: Puh-Relel Algorihm Heigh 4/4 4 0 0/5 0/3 0/6 0/3 0/2 0/6 5 0/1 0 0/2

18-51: Puh-Relel Algorihm Heigh 4/4 4 0 0/5 0/3 0/6 0/3 0/2 0/6 5 0/1 0 0/2

18-52: Puh-Relel Algorihm Heigh 4/4 0 4 4/5 0/3 0/6 0/3 0/2 0/6 5 0/1 0 0/2

18-53: Puh-Relel Algorihm Heigh 4/4 0 4 4/5 0/3 0/6 0/3 0/2 0/6 5 0/1 0 0/2

18-54: Puh-Relel Algorihm Heigh 4/4 0 0 4/5 0/3 4/6 0/3 0/2 0/6 5 0/1 0 0/2

18-55: Puh-Relel Algorihm Heigh 4/4 0 0 4/5 0/3 4/6 0/3 0/2 0/6 5 0/1 0 0/2

18-56: Puh-Relel Algorihm Heigh 4/4 0 0 4/5 0/3 4/6 0/3 0/2 0/6 4 1/1 1 0/2

18-57: Puh-Relel Algorihm Heigh 4/4 0 0 4/5 0/3 4/6 0/3 0/2 0/6 4 1/1 1 0/2

18-58: Puh-Relel Algorihm Heigh 4/4 0 3 4/5 3/3 4/6 0/3 0/2 0/6 1 1/1 1 0/2

18-59: Puh-Relel Algorihm Heigh 4/4 1 3 4/5 3/3 4/6 1/3 0/2 0/6 0 1/1 1 0/2

18-60: Puh-Relel Algorihm Heigh 4/4 1 3 4/5 3/3 4/6 1/3 0/2 0/6 0 1/1 1 0/2

18-61: Puh-Relel Algorihm Heigh 4/4 1 3 4/5 3/3 4/6 1/3 0/2 0/6 0 1/1 0 1/2

18-62: Puh-Relel Algorihm Heigh 4/4 1 3 4/5 3/3 4/6 1/3 0/2 0/6 0 1/1 0 1/2

18-63: Puh-Relel Algorihm Heigh 4/4 0 4 3/3 4/6 1/3 0/2 0/6 0 1/1 0 1/2

18-64: Puh-Relel Algorihm Heigh 4/4 0 2 3/3 6/6 1/3 0/2 0/6 0 1/1 0 1/2

18-65: Puh-Relel Algorihm Heigh 4/4 0 2 3/3 6/6 1/3 0/2 0/6 0 1/1 0 1/2

18-66: Puh-Relel Algorihm Heigh 4/4 0 0 3/3 6/6 1/3 2/2 0/6 0 1/1 2 1/2

18-67: Puh-Relel Algorihm Heigh 4/4 0 0 3/3 6/6 1/3 2/2 0/6 0 1/1 1 2/2

18-68: Puh-Relel Algorihm Heigh 4/4 0 0 3/3 6/6 1/3 2/2 0/6 0 1/1 1 2/2

18-69: Puh-Relel Algorihm Heigh 4/4 0 0 3/3 6/6 1/3 2/2 0/6 1 0/1 0 2/2

18-70: Puh-Relel Algorihm Heigh 4/4 0 0 3/3 6/6 1/3 2/2 0/6 1 0/1 0 2/2

18-71: Puh-Relel Algorihm Heigh 4/4 1 0 3/3 6/6 2/3 2/2 0/6 0 0/1 0 2/2

18-72: Puh-Relel Algorihm Heigh 4/4 1 0 3/3 6/6 2/3 2/2 0/6 0 0/1 0 2/2

18-73: Puh-Relel Algorihm Heigh 4/4 0 0 3/3 6/6 1/3 2/2 0/6 1 0/1 0 2/2

18-74: Puh-Relel Algorihm Heigh 4/4 0 0 3/3 6/6 1/3 2/2 0/6 1 0/1 0 2/2

18-75: Puh-Relel Algorihm Heigh 4/4 0 0 3/3 6/6 1/3 2/2 0/6 0 1/1 1 2/2

18-76: Puh-Relel Algorihm Heigh 4/4 0 1 3/3 6/6 1/3 1/2 0/6 0 1/1 0 2/2

18-77: Puh-Relel Algorihm Heigh 4/4 0 1 3/3 6/6 1/3 1/2 0/6 0 1/1 0 2/2

18-78: Puh-Relel Algorihm Heigh 4/4 0 0 3/3 6/6 1/3 2/2 0/6 0 1/1 1 2/2

18-79: Puh-Relel Algorihm Heigh 4/4 0 0 3/3 6/6 1/3 2/2 0/6 0 1/1 1 2/2

18-80: Puh-Relel Algorihm Heigh 4/4 0 0 3/3 6/6 1/3 2/2 0/6 1 0/1 0 2/2

18-81: Puh-Relel Algorihm Heigh 4/4 0 0 3/3 6/6 1/3 2/2 0/6 1 0/1 0 2/2

18-82: Puh-Relel Algorihm Heigh 4/4 0 0 3/3 6/6 1/3 2/2 0/6 4/5 0 0/1 0 2/2

18-83: Puh-Relel Algorihm Puh(u, v) Applie when: u i overflowing f (u,v) > 0 h[u] = h[v]+1 Aion: Puh min(overflow[u], f (u,v)) o v

18-84: Puh-Relel Algorihm Relel(u) Applie when: u i overflowing For ll v uh h f (u,v) > 0 h[v] h[u] Aion: h[u] h[u]+1

18-85: Puh-Relel Algorihm Puh-Relel(G) Iniilize-Preflow(G, ) while here exi n pplile puh/relel implemen puh/relel

18-86: Puh-Relel Algorihm Puh-Relel(G) Iniilize-Preflow(G, ) while here exi n pplile puh/relel implemen puh/relel Pik he operion (puh/relel) rirrily, ime i O( V 2 E) (We won prove hi reul, hough he proof i in he ook) Cn o eer wih relel-o-fron Speifi orering for oing puh-relel Time O( V 3 ), lo no proven here, proof in ex