Flows sourcesink s t Flows sourcesink 5 2 4 2 3 4 7 2 edge-weights = capacities.

Slides:



Advertisements
Similar presentations
1 Review of some graph algorithms Graph G(V,E) (Chapter 22) –Directed, undirected –Representation Adjacency-list, adjacency-matrix Breadth-first search.
Advertisements

Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
CSE 326: Data Structures Network Flow and APSP Ben Lerner Summer 2007.
The Maximum Network Flow Problem. CSE Network Flows.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Advanced Algorithm Design and Analysis (Lecture 8) SW5 fall 2004 Simonas Šaltenis E1-215b
Lectures on Network Flows
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 The Max Flow Problem. 2 Flow networks Flow networks are the problem instances of the max flow problem. A flow network is given by 1) a directed graph.
CS138A Network Flows Peter Schröder. CS138A Flow Networks Definitions a flow network G=(V,E) is a directed graph in which each edge (u,v)
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2001 Lecture 4 Tuesday, 2/19/02 Graph Algorithms: Part 2 Network.
1 Maximum flow problems. 2 - Introduction of: network, max-flow problem capacity, flow - Ford-Fulkerson method pseudo code, residual networks, augmenting.
1 Maximum Flow Maximum Flow Problem The Ford-Fulkerson method Maximum bipartite matching.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 4 Tuesday, 10/2/01 Graph Algorithms: Part 2 Network.
Yangjun Chen 1 Network Flow What is a network? Flow network and flows Ford-Fulkerson method - Residual networks - Augmenting paths - Cuts of flow networks.
Maximum Flows Lecture 4: Jan 19. Network transmission Given a directed graph G A source node s A sink node t Goal: To send as much information from s.
The max-flow problem Defined on a capacitated directed graph G=(V,E,c). The capacities are non-negative G st 11.
Maximum flow Algorithms and Networks. A&N: Maximum flow2 Today Maximum flow problem Variants Applications Briefly: Ford-Fulkerson; min cut max flow theorem.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Lecture 5 Wednesday, 10/6/04 Graph Algorithms: Part 2.
1 The Min Cost Flow Problem. 2 Flow Networks with Costs Flow networks with costs are the problem instances of the min cost flow problem. A flow network.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
1 Ford-Fulkerson method Ford-Fulkerson(G) f = 0 while( 9 simple path p from s to t in G f ) f := f + f p output f Runs in time O(|f max | |E|) where f.
Maximum Flow Maximum Flow Problem The Ford-Fulkerson method
1 The Min Cost Flow Problem. 2 The Min Cost Flow problem We want to talk about multi-source, multi-sink flows than just “flows from s to t”. We want to.
Flow Networks Formalization Basic Results Ford-Fulkerson Edmunds-Karp Bipartite Matching Min-cut.
Maximum Flow Chapter 26.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
Yangjun Chen 1 Network Flow What is a network? Flow network and flows Ford-Fulkerson method - Residual networks - Augmenting paths - Cuts of flow networks.
Single Source Shortest-Path: The General Case (with negative edges) Bellman-Ford algorithm. Iteratively relax all edges |V|-1 times Running time? O(VE).
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
CS 473Lecture ?1 CS473-Algorithms I Lecture ? Network Flows Finding Max Flow.
Max Flow – Min Cut Problem. Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material.
CS 473Lecture ?1 CS473-Algorithms I Lecture ? Network Flows Flow Networks & Flows.
Maximum Flow Chapter 26. Flow Concepts Source vertex s – where material is produced Sink vertex t – where material is consumed For all other vertices.
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
Chapter 7 April 28 Network Flow.
Network Flow Analysis of Algorithms.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25.
Algorithm Design and Analysis (ADA)
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Flow Networks Ching-Chen Huang Hsi-Yue Hsiao. CONTENTS Network flows on directed acyclic graphs Ford-fulkerson Algorithms -Residual networks.
1 Network Flow CSC401 – Analysis of Algorithms Chapter 8 Network Flow Objectives: Flow networks –Flow –Cut Maximum flow –Augmenting path –Maximum flow.
Fall 2003Maximum Flow1 w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
A directed graph G consists of a set V of vertices and a set E of arcs where each arc in E is associated with an ordered pair of vertices from V. V={0,
Maximum Flow Problem Definitions and notations The Ford-Fulkerson method.
The Maximum Network Flow Problem
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Maximum Flow Chapter 26.
Maximum Flow Chapter 26.
CS4234 Optimiz(s)ation Algorithms
Algorithms and Networks Hans Bodlaender
Richard Anderson Lecture 23 Network Flow
Lecture 22 Network Flow, Part 2
Network Flow 2016/04/12.
Edmonds-Karp Algorithm
Network Flows and Matching (Supplementary)
Lecture 10 Network flow Max-flow and Min-cut Ford-Fulkerson method
Flow Networks Topics Flow Networks Residual networks
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 21 Network Flow
Network Flows and Matching (Supplementary)
Lecture 21 Network Flow, Part 1
Richard Anderson Lecture 22 Network Flow
Lecture 21 Network Flow, Part 1
Lecture 22 Network Flow, Part 2
Richard Anderson Lecture 22 Network Flow
Presentation transcript:

Flows sourcesink s t

Flows sourcesink edge-weights = capacities

Flows sourcesink edge-weights = capacities 4 units of flow

Flows sourcesink edge-weights = capacities 6 units of flow 2

Flows sourcesink edge-weights = capacities 7 units of flow 3 1

Optimal?  a larger flow?

Cuts s C C  V s  C t  V-C capacity of a cut cap(C)=  c(u,v) u  C v  V-C for any cut and any flow flow  cut max-flow  min-cut 

Flows edge-weights = capacities 3 FLOW CONSERVATION

Skew symmetry edge-weights = capacities 3 FLOW CONSERVATION x -x

Flows edge-weights = capacities 3 FLOW CONSERVATION x -x  f(u,v) = 0 vVvV

Flow – formal definition FLOW CONSERVATION CAPACITY CONSTRAINTS  f(u,v) = 0 vVvV f(u,v)  c(u,v) SKEW SYMMETRY f(u,v) = - f(v,u)

Max-flow problem INPUT: directed graph G=(V,E), source s  V, sink t  V a capacity c(e) for each edge e  E OUTPUT: maximum flow from s to t

Max-flow problem F  zero-flow while can improve F improve F

Max-flow problem improving can decrease flow on some edges

+1 +1 Augmenting path

+1 Augmenting path

+1 Augmenting path  can improve the flow F  zero-flow while  augmenting path p improve F along p Ford-Fulkerson algorithm

Residual capacity f(u,v) c(u,v) r(u,v) = c(u,v) – f(u,v) makes sense for negative f(u,v)

Residual network

Is there an augmenting path? Is there a path from s to t in the residual network?

Correct ? F  zero-flow while  augmenting path p improve F along p

Correct ? F  zero-flow while  augmenting path p improve F along p Theorem: no augmenting path  max-flow YES

Theorem: no augmenting path  max-flow Proof: no augmenting path  no path from s to t in the residual network st

Theorem: no augmenting path  max-flow Proof: no augmenting path  no path from s to t in the residual network st vertices to which we can get from s

Theorem: no augmenting path  max-flow Proof: no augmenting path  no path from s to t in the residual network st vertices to which we can get from s all edges from C to V-C saturated C

Theorem: no augmenting path  max-flow Theorem 2: max-flow = min-cut

Is there an augmenting path? Is there a path from s to t in the residual network? time O(E) F  zero-flow while  augmenting path p improve F along p time = ?

F  zero-flow while  augmenting path p improve F along p

F  zero-flow while  augmenting path p improve F along p

F  zero-flow while  augmenting path p improve F along p

F  zero-flow while  augmenting path p improve F along p

F  zero-flow while  augmenting path p improve F along p

F  zero-flow while  augmenting path p improve F along p

F  zero-flow while  augmenting path p improve F along p

F  zero-flow while  augmenting path p improve F along p

F  zero-flow while  augmenting path p improve F along p Assume that the capacities are integers. Then the number of augementations is bounded by F * (=max-flow) running time O(E F * )

F  zero-flow while  augmenting path p improve F along p running time O(E F * ) can a good choice of p improve the algorithm?

F  zero-flow while  augmenting path p improve F along p 1. choose path p which increases the flow the most (i.e., p has the maximum bottleneck capacity) 2. choose path p which has the fewest number of edges

1. choose path p which increases the flow the most (i.e., p has the maximum bottleneck capacity) THEOREM: number of augmenting steps  O(E log F * )

Graph G flow f in G Residual network G f f’=flow in G f Claim: h=f+f’ is a flow in G SKEW SYMMETRY: h(u,v)=f(u,v)+f’(u,v)=-f(v,u)-f’(v,u) = - (f(v,u) + f’(v,u)) = - h(v,u) FLOW CONSERVATION:  u h(u,v) =  u (f(u,v)+f’(u,v))=  u f(u,v) +  u f’(u,v) = 0

Graph G flow f in G Residual network G f f’=flow in G f Claim: h=f+f’ is a flow in G CAPACITY CONSTRAINTS: f’(u,v)  c(u,v)-f(u,v)  h(u,v)=f(u,v)+f’(u,v)  c(u,v)

Graph G flow f in G Residual network G f f’=flow in G f Claim: f’=h-g is a flow in G f CAPACITY CONSTRAINTS: f’(u,v)  h(u,v)-f(u,v)  c(u,v)-f(u,v) flow h in G

Claim: any flow f in G is a sum of at most |E| path flows Induction on the number of non-zero edges in f

Claim: any flow f in G is a sum of at most |{e  E;f(e)  0}| path flows Induction on the number of non-zero edges in f G’ with capacities c’(u,v)=max{0,f(u,v)} p = augmenting path from zero flow in G’ p has bottleneck edge  f-p has less non-zero edges than f f = flow f = p + (f-p)

1.choose path p which increases the flow the most (i.e., p has the maximum bottleneck capacity) THEOREM: number of augmenting steps O(E log F * ) Claim: any flow f in G is a sum of at most |E| path flows Graph G flow f in G Residual network G f f’=f * -f max-flow f * in G  path with bottleneck capacity  f’/|E|

1.choose path p which increases the flow the most (i.e., p has the maximum bottleneck capacity) THEOREM: number of augmenting steps O(E log F * ) Graph G flow f in G Residual network G f f’=f * -f max-flow f * in G  path with bottleneck capacity  f’/|E| max-flow in the residual graph decreases by a factor of at least (1-1/|E|)

2. choose path p which has the fewest number of edges THEOREM: number of augmenting steps  O(E V)

2. choose path p which has the fewest number of edges level graph = BFS in the residual network

2. choose path p which has the fewest number of edges level graph = BFS in the residual network

2. choose path p which has the fewest number of edges 1) one such edge saturated 2) no new introduced count edges in the residual graph which are on a path of length d from s to t

Plain Ford-Fulkerson O(E F * ) Maximum bottleneck capacity O( (E+V log V) E log F  ) Fewest edges O(E 2 V)

Max-matching in bipartite graphs

st solution using max-flow all edge weights =1

Max-matching in bipartite graphs solution using max-flow st all edge weights =1 Plain Ford-Fulkerson O(E F * ) Maximum bottleneck capacity O( (E+V log V) E log F  ) Fewest edges O(E 2 V) which one to use?