Graphs III - Network Flow

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

Today: Max Flow Proofs

1 Motivation and Basic Definitions

CS4445/9544 Analysis of Algorithms II Solution for Assignment 1

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

Algorithm Design and Analysis

Network Flow. Data Structures and Algorithms Andrei Bulatov

Main Reference: Sections in CLRS.

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

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

Network Flows: Introduction & Maximum Flow

Maximum Flow and Minimum Cut

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

Algorithmic Discrete Mathematics 6. Exercise Sheet

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

Soviet Rail Network, 1955

CSE 521: Design & Analysis of Algorithms I

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

Soviet Rail Network, 1955

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

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

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

Matching. Slides designed by Kevin Wayne.

Reminder: Flow Networks

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)

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

CSE 421 Introduction to Algorithms Winter The Network Flow Problem

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

Randomized Perfect Bipartite Matching

Algorithm Design and Analysis

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

18 Extensions of Maximum Flow

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

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

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

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.

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

Network Flows UPCOPENCOURSEWARE number 34414

16 Max-Flow Algorithms and Applications

Introduction to Congestion Games

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

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

23 Maximum Flows and Minimum Cuts

Algorithms. Algorithms 6.4 MAXIMUM FLOW

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

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

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

Introduction to SLE Lecture Notes

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

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

Maximum Flow in Planar Graphs

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

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

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

How to Solve System Dynamic s Problems

introduction Ford-Fulkerson algorithm

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

CHAPTER 7: SECOND-ORDER CIRCUITS

16 Max-Flow Algorithms

Ford-Fulkerson Algorithm for Maximum Flow

EECE 301 Signals & Systems Prof. Mark Fowler

introduction Ford-Fulkerson algorithm

Maximum Flow. Flow Graph

Notes for Lecture 17-18

CHAPTER 12 DIRECT CURRENT CIRCUITS

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

8. Basic RL and RC Circuits

u(t) Figure 1. Open loop control system

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

Graduate Algorithms CS F-18 Flow Networks

Topics in Combinatorial Optimization May 11, Lecture 22

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

Graph Theory: Network Flow

Phys1112: DC and RC circuits

Ma/CS 6a Class 15: Flows and Bipartite Graphs

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

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

, 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

Longest Common Prefixes

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

Timed Circuits. Asynchronous Circuit Design. Timing Relationships. A Simple Example. Timed States. Timing Sequences. ({r 6 },t6 = 1.

Solutions to Assignment 1

EXERCISES FOR SECTION 1.5

CS4800: Algorithms & Data Jonathan Ullman

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

Average Case Lower Bounds for Monotone Switching Networks

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

Electrical and current self-induction

Exponential Sawtooth

UCLA: Math 3B Problem set 3 (solutions) Fall, 2018

18.03SC Unit 3 Practice Exam and Solutions

!!"#"$%&#'()!"#&'(*%)+,&',-)./0)1-*23)

Discussion Session 2 Constant Acceleration/Relative Motion Week 03

Efficient Algorithms for Computing Disjoint QoS Paths

To become more mathematically correct, Circuit equations are Algebraic Differential equations. from KVL, KCL from the constitutive relationship

Network Flow Applications

Reading from Young & Freedman: For this topic, read sections 25.4 & 25.5, the introduction to chapter 26 and sections 26.1 to 26.2 & 26.4.

Logistic growth rate. Fencing a pen. Notes. Notes. Notes. Optimization: finding the biggest/smallest/highest/lowest, etc.

Stationary Distribution. Design and Analysis of Algorithms Andrei Bulatov

Stat13 Homework 7. Suggested Solutions

Transcription:

Graph III - Nework Flow

Flow nework eup graph G=(V,E) edge capaciy w(u,v) 0 - if edge doe no exi, hen w(u,v)=0 pecial verice: ource verex ; ink verex - no edge ino and no edge ou of Aume every verex v i on a pah from ource o ink ( v ) - verice v ha are no on uch pah can be ignored (deleed) along wih all connecing edge

Flow nework flow i a funcion f:vxv->r uch ha - flow from u o v: f(u,v) w(u,v) - ymmery f(u,v) = -f(v,u) - flow i conerved on all node excep ource and ink X vv f(u, v) =0 oal flow (from he orce)

Maximum Flow Problem deermine he flow f ha realize he maximum oal flow

More on Flow f(u,u)=0 oal ne flow ino/ou-o a verex i 0 X vv f(v, u) =0 - excep for ource and ink if edge (u,v) i miing in G, here can be no ne flow from u o v

More on Flow poiive ne flow enering v X uv ;f(u,v)>0 f(u, v) poiive ne flow leaving v hee wo are equal X f(v, u) uv ;f(v,u)>0

Cancellaion poiive flow on (u,v) cancel poiive flow on (v,u) unil only one i poiive (he oher become 0) - boh flow decreae, o hey ill aify capaciy conrain - flow conervaion aified ince boh flow reduced by he ame amoun

Ford-Fulkeron wan he max flow for ource o ink - a cla of algorihm, no a ingle one iniialize flow wih O; repea find an augmening pah from o (ha admi more flow) end more flow on ha pah unil no augmening pah exi have o prove ha hi erminaion condiion implie he flow i max. - if an augmening pah exi, ending more flow o i increae he value of he exiing flow

Reidual nework afer ending ome flow on a pah from o, he graph eenially change - exiing flow edge will have a differen capaciy in he reidual nework (becaue he flow ue ome) - new edge can appear (in red) : he poibiliie of revering he exiing flow

Reidual nework reidual capaciy of edge (u,v) : r(u,v) = w(u,v)-f(u,v) reidual nework R induced by f i given by he e of edge alo called R wih poiive reidual capaciy - edge e R = { (u,v) : r(u,v)>0 } noe ha ome new edge appear! u 3 v - example (u,v) E; w(u,v)=3, f(u,v)= - hen r(u,v) = 3- = - edge (v,u) no in he original graph u v - bu r(v,u) = 0 - f(v,u) = 0- (-)=; herefore edge (v,u) i now par of he reidual nework. edge (v,u) can be par of he reidual newwork only if eiher (u,v) or (v,u) are edge in he original graph - hu R E

Augmening pah any pah p= -> in he reidual nework R he reidual capaciy of he pah p i he minimum ( boleneck ) edge reidual capaciy - r(p) = min { r(u,v) : (u,v) p } add he pah p a addiional flow f p of ize r(p) - o he exiing flow f ha creaed R - new flow f = f + f p - increae he flow oal by r(p). Proof in he book.

Cu in flow nework Cu C = (S,T) i a pariion of verice - S T=V ; S T= ; S=V T - S conain he ource and T conain he ink S; T Ne flow acro cu i f(s,t), he um of all flow on edge from S o T f(s,t)=3 ; w(s,t)=5 capaciy of a cu i he um of edge capaciy from S o T

Max Flow - Min Cu heorem (S,T) i a cu, f a flow wih oal value f. Then - f(s,t) = f (he oal flow value) - conequenly f w(s,t) : flow value i maller han he capaciy of any cu MAX-FLOW MIN-CUT heorem. The following are equivalen: - (a) f i a max flow - (b) reidual nework R=R f ha no augmening pah - (c) here i a cu (S,T) uch ha f = w(s,t)

Max Flow - Min Cu proof inuiion (a)=>(b) already dicued (b)=>(c): conider S = { v pah v in reidual R} - S - T =V S; T. If S, hen here would be a augmening pah in R - R can have an edge (v S, u T) becaue ha would mean u S - hu exiing flow aurae he cu (S,T) v v v impoible v u u u (c)=>(a): no flow can be bigger han capaciy of a cu, o f mu be a maximum flow (ince i aurae he cu decribed above)

Ford-Fulkeron for each edge (u,v) ini: f(u,v)=0; f(v,u)=0 R = G while exi pah p( )in reidual R c(p) = min { r(u,v); (u,v) p }//pah capaciy, ued a new flow for each (u,v) p f(u,v) = f(u,v) + c(p) ; f(v,u)= - f(u,v) recompue reidual nework R=Rf

Ford-Fulkeron Running ime wih ineger capaciie - fing a pah in R i O(E) (ay wih DFS) - f =oal flow value - a mo f ieraion; every ieraion increae he flow by or more - oal O(E* f ) problem: f can be very large, hu he algorihm very low - for real-value edge cacpaciie, Ford-Fulkeron can be arbirary low

Ford-Fulkeron Running ime wih ineger capaciie - fing a pah in R i O(E) (ay wih DFS) - f =oal flow value - a mo f ieraion; every ieraion increae he flow by or more - oal O(E* f ) problem: f can be very large, hu he algorihm very low - for real-value edge cacpaciie, Ford-Fulkeron can be arbirary low

Ford-Fulkeron Running ime wih ineger capaciie - fing a pah in R i O(E) (ay wih DFS) - f =oal flow value - a mo f ieraion; every ieraion increae he flow by or more - oal O(E* f ) problem: f can be very large, hu he algorihm very low - for real-value edge cacpaciie, Ford-Fulkeron can be arbirary low

Ford-Fulkeron Running ime wih ineger capaciie - fing a pah in R i O(E) (ay wih DFS) - f =oal flow value - a mo f ieraion; every ieraion increae he flow by or more - oal O(E* f ) problem: f can be very large, hu he algorihm very low - for real-value edge cacpaciie, Ford-Fulkeron can be arbirary low

Ford-Fulkeron Running ime wih ineger capaciie - fing a pah in R i O(E) (ay wih DFS) - f =oal flow value - a mo f ieraion; every ieraion increae he flow by or more - oal O(E* f ) problem: f can be very large, hu he algorihm very low - for real-value edge cacpaciie, Ford-Fulkeron can be arbirary low

Ford-Fulkeron Running ime wih ineger capaciie - fing a pah in R i O(E) (ay wih DFS) - f =oal flow value - a mo f ieraion; every ieraion increae he flow by or more - oal O(E* f ) problem: f can be very large, hu he algorihm very low - for real-value edge cacpaciie, Ford-Fulkeron can be arbirary low

Ford-Fulkeron Running ime wih ineger capaciie - fing a pah in R i O(E) (ay wih DFS) - f =oal flow value - a mo f ieraion; every ieraion increae he flow by or more - oal O(E* f ) problem: f can be very large, hu he algorihm very low - for real-value edge cacpaciie, Ford-Fulkeron can be arbirary low

Ford-Fulkeron Running ime wih ineger capaciie - fing a pah in R i O(E) (ay wih DFS) - f =oal flow value - a mo f ieraion; every ieraion increae he flow by or more - oal O(E* f ) problem: f can be very large, hu he algorihm very low - for real-value edge cacpaciie, Ford-Fulkeron can be arbirary low

Ford-Fulkeron Running ime wih ineger capaciie - fing a pah in R i O(E) (ay wih DFS) - f =oal flow value - a mo f ieraion; every ieraion increae he flow by or more - oal O(E* f ) problem: f can be very large, hu he algorihm very low - for real-value edge cacpaciie, Ford-Fulkeron can be arbirary low

Ford-Fulkeron Running ime wih ineger capaciie - fing a pah in R i O(E) (ay wih DFS) - f =oal flow value - a mo f ieraion; every ieraion increae he flow by or more - oal O(E* f ) problem: f can be very large, hu he algorihm very low - for real-value edge cacpaciie, Ford-Fulkeron can be arbirary low

Ford-Fulkeron Running ime wih ineger capaciie - fing a pah in R i O(E) (ay wih DFS) - f =oal flow value - a mo f ieraion; every ieraion increae he flow by or more - oal O(E* f ) problem: f can be very large, hu he algorihm very low - for real-value edge cacpaciie, Ford-Fulkeron can be arbirary low 997 3 3 997

Ford-Fulkeron Running ime wih ineger capaciie - fing a pah in R i O(E) (ay wih DFS) - f =oal flow value - a mo f ieraion; every ieraion increae he flow by or more - oal O(E* f ) problem: f can be very large, hu he algorihm very low - for real-value edge cacpaciie, Ford-Fulkeron can be arbirary low 997 3 3 997

Edmond-Karp ame a FF, bu find he augmening pah wih BFS for each edge (u,v) ini: f(u,v)=0; f(v,u)=0 R = G while BFS find pah p( )in reidual R c(p) = min { r(u,v); (u,v) p }//pah capaciy, ued a new flow for each (u,v) p f(u,v) = f(u,v) + c(p) ; f(v,u)= - f(u,v) recompue reidual nework R=Rf

Analyi of Edmond-Karp BFS will find he augmening pah wih fewe number of edge noe ha previu oy bad example would find max flow afer wo ieraion

Analyi of Edmond-Karp BFS will find he augmening pah wih fewe number of edge noe ha previu oy bad example would find max flow afer wo ieraion

Analyi of Edmond-Karp BFS will find he augmening pah wih fewe number of edge noe ha previu oy bad example would find max flow afer wo ieraion

Analyi of Edmond-Karp BFS will find he augmening pah wih fewe number of edge noe ha previu oy bad example would find max flow afer wo ieraion

Analyi of Edmond-Karp BFS will find he augmening pah wih fewe number of edge noe ha previu oy bad example would find max flow afer wo ieraion

Analyi of Edmond-Karp How many augmening pah can EK find? - augmening pah p ha criical edge (u,v), if (u,v) i he minimum reidual capaciy edge on he pah - any edge can be criical a mo V ime during EK. Proof in he book - here are E edge, o a mo V * E criical edge for he enire execuion - hu a mo O(VE) augmening pah (each pah ha a lea one criical edge) BFS ake O(E) o find each augmening pah oal O(VE )

Puh-Relabel (Opional reading) Advanced maerial no covered - opional reading from book inuiion : flood he nework, uing verex heigh - node can accumulae flow - he more flow hey accumulae, he higher hey go - flow goe downhill pracical / fa implemenaion: O(V 3 ) running ime.