Max-flow, Min-cut Network flow.

Slides:



Advertisements
Similar presentations
Maximum flow Main goals of the lecture:
Advertisements

Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: uij is the capacity on arc (i,j). Find non-negative flow fij for.
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
1 Augmenting Path Algorithm s t G: Flow value = 0 0 flow capacity.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
1 Augmenting Path Algorithm s t G: Flow value = 0 0 flow capacity.
3 t s the black numbers next to an arc is its capacity.
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.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Announcements Network Flow today, depending on how far we get, we will do String Matching on Wednesday Then Review for Final next Monday This week’s lab.
Network Flow. Network flow formulation A network G = (V, E). Capacity c(u, v)  0 for edge (u, v). Assume c(u, v) = 0 if (u, v)  E. Source s and sink.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
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.
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,
Flow A flow f for a network N is is an assignment of an integer value f(e) to each edge e that satisfies the following properties: Capacity Rule: For each.
Network Flow.
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Finding a Path With Largest Smallest Edge
Lectures on Network Flows
Richard Anderson Lecture 23 Network Flow
Maximum Flow 9/13/2018 6:12 PM Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
CSCI 3160 Design and Analysis of Algorithms Tutorial 8
Network Flow.
Max Flow min Cut.
Ford-Fulkerson.
Max-flow, Min-cut Network flow.
Network Flow 2016/04/12.
Instructor: Shengyu Zhang
Edmonds-Karp Algorithm
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
CSE Algorithms Max Flow Problems 11/21/02 CSE Max Flow.
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
7. Ford-Fulkerson Demo.
7. Ford-Fulkerson Demo.
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 21 Network Flow
Augmenting Path Algorithm
Kruskal’s MST Maximum Flow
Flow Networks General Characteristics Applications
Flow Networks and Bipartite Matching
Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: uij is the capacity on arc (i,j). Find non-negative flow fij for.
Algorithms (2IL15) – Lecture 7
Network Flow CSE 373 Data Structures.
EE5900 Advanced Embedded System For Smart Infrastructure
Max Flow / Min Cut.
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Network Flow.
Lecture 21 Network Flow, Part 1
7. Ford-Fulkerson Demo.
MAXIMUM flow by Eric Wengert.
Augmenting Path Algorithm
Introduction to Maximum Flows
Richard Anderson Lecture 22 Network Flow
7. Edmonds-Karp Algorithm
Lecture 21 Network Flow, Part 1
Maximum Flow Neil Tang 4/8/2008
7. Edmonds-karp Demo.
7. Ford-Fulkerson Demo.
7. Ford-Fulkerson Demo.
7. Ford-Fulkerson Demo.
7. Ford-Fulkerson Demo.
Introduction to Maximum Flows
Network Flow.
7. Ford-Fulkerson Demo.
Richard Anderson Lecture 22 Network Flow
7. Ford-Fulkerson Demo.
Maximum Flow Problems in 2005.
Presentation transcript:

Max-flow, Min-cut Network flow

Max-flow Maximize the total amount of flow from s to t subject to two constraints Flow on edge e doesn’t exceed c(e) For every node v ≠ {s, t}, incoming flow is equal to outgoing flow

Max-flow: Ford-Fulkerson Find paths from s to t using depth first search Find paths using the residual graph G’

Ford-Fulkerson: example 4 10 0|4 2 2 0|10 0|2 0|2 7 10 7 s t 0|7 0|10 0|7 s t 2 2 0|2 0|2 6 10 0|10 0|6 G G Depth first search f = min(4,10)=4 0|4 0|10 4|4 4|10 0|2 0|2 0|2 0|2 0|7 0|10 0|7 0|7 0|10 0|7 s t s t 0|2 0|2 0|2 0|2 0|6 0|6 0|10 0|10 G G

Ford-Fulkerson: DFS s t s t s t s t G G G G f = min(7,10,7)=7 4|4 4|10 4|4 4|10 0|2 0|2 0|2 0|2 0|7 0|10 0|7 7|7 7|10 7|7 s t s t 0|2 0|2 0|2 0|2 0|6 0|10 0|6 0|10 G G f = min(10,6)=6 4|4 4|10 4|4 4|10 0|2 0|2 0|2 0|2 7|7 7|10 7|7 7|7 7|10 7|7 s t s t 0|2 0|2 0|2 0|2 0|10 0|6 6|6 6|10 G G

Ford-Fulkerson: Residual graph 4|4 4|10 ? ? 0|2 0|2 ? ? 7|7 7|10 7|7 ? ? ? s t s t 0|2 0|2 ? ? 6|6 ? 6|10 ? G G’ G G’ 4|4 4|10 4 ? 0|2 0|2 ? 7|7 7|10 7|7 s t ? ? ? s t 0|2 0|2 ? ? 6|6 6|10 ? ?

Ford-Fulkerson: Residual graph 4|4 4|10 4 4 0|2 0|2 ? 6 7|7 7|10 7|7 s t ? ? ? s t 0|2 0|2 ? ? 6|6 6|10 ? ? G G’ 4|4 4|10 4 4 0|2 0|2 ? 6 7|7 7|10 7|7 s t ? ? s t 7 0|2 0|2 ? ? 6|6 6|10 ? ? G G’

Ford-Fulkerson: Residual graph 4|4 4|10 4 4 0|2 0|2 2 6 7|7 7|10 7|7 s t ? ? s t 7 0|2 0|2 ? ? 6|6 6|10 ? ? G G’ 4|4 4|10 4 4 0|2 0|2 2 6 7|7 7|10 7|7 s t ? ? s t 7 0|2 0|2 ? 6 ? 6|10 6|6 4 ? G G’

Ford-Fulkerson: Residual graph Keep work on for the rest of edges 4|4 4|10 4 4 0|2 0|2 2 2 6 7|7 7|10 7|7 s t 3 7 s t 7 7 0|2 0|2 2 6 2 6|6 6|10 4 6 G G’ 4 4 2 2 6 3 7 s t Remove “0” edge (optional) 7 7 4 2 6 2 6 G’

Ford-Fulkerson: Residual graph Any more paths? 4 4 2 2 6 3 7 s t 7 7 2 4 2 6 6 G’ f = min(6,2,3,2,4)=2 4 4 4|4 2 6|10 2 6 2|2 0|2 3 7 s t 7|7 5|10 7|7 s t 7 7 2 4 2 6 0|2 2|2 6 6|6 8|10 G’ G

Max flow = 6 + 7 +6 = 19 s t G 4|4 6|10 2|2 0|2 7|7 5|10 7|7 0|2 2|2 8|10 6|6 G

Edmonds-Karp Edmonds-Karp = Ford-Fulkerson + “Choose the augmenting path with the smallest number of edges” or “Choose the augmenting path with the largest bottle neck value”

Edmonds-Karp vs Ford-Fulkerson 0|4 0|10 0|2 0|2 0|7 0|10 0|7 s t 0|2 0|2 0|6 Edmonds-Karp Ford-Fulkerson G Ford-Fulkerson 0|4 0|10 0|2 0|2 0|4 0|10 0|2 0|2 0|7 0|10 0|7 s t 0|7 0|10 0|7 s t 0|2 0|2 0|10 0|6 0|2 0|2 0|10 0|6 G G Which one is the valid first choice of Edmonds-Karp? Which one is the valid first choice of Ford-Fulkerson?

Min cut We want to remove some edges from the graph such that after removing the edges, there is no path from s to t The cost of removing e is equal to its capacity c(e) The minimum cut problem is to find a cut with minimum total cost

Min cut: approach “Subtract” the max-flow from the original graph Mark all nodes reachable from s. Call the set of reachable nodes A Now separate these nodes from the others Cut edges going from A to V − A

Min cut: example s t s t s t G G max flow 4 10 4 6 2 2 2 7 10 7 7 s t 5 7 s t 2 2 2 6 8 10 6 G G max flow s t G – G max flow = residual graph

Min cut: example s t s t s t G G max flow 4 10 4 6 2 2 2 7 10 7 7 s t 5 7 s t 2 2 2 6 8 10 6 G G max flow s t G – G max flow = residual graph

Min cut: example s t s t s t G G max flow 4 10 4 6 2 2 2 7 10 7 7 s t 5 7 s t 2 2 2 6 8 10 6 G G max flow s t G – G max flow = residual graph

Min cut: example s t s t s t G G max flow 4 10 4 6 2 2 2 7 10 7 7 s t 5 7 s t 2 2 2 6 8 10 6 G G max flow s t G – G max flow = residual graph

Min cut: example s t s t s t G G max flow 4 10 4 6 2 2 2 7 10 7 7 s t 5 7 s t 2 2 2 6 8 10 6 G G max flow s t G – G max flow = residual graph

Min cut: example s t s t s t G G max flow 4 10 4 6 2 2 2 7 10 7 7 s t 5 7 s t 2 2 2 6 8 10 6 G G max flow s t G – G max flow = residual graph

Min cut: example s t s t s t G G max flow 4 10 4 6 2 2 2 7 10 7 7 s t 5 7 s t 2 2 2 6 8 10 6 G G max flow s t G – G max flow = residual graph

Min cut: example s t s t s t G G max flow 4 10 4 6 2 2 2 7 10 7 7 s t 5 7 s t 2 2 2 6 8 10 6 G G max flow s t G – G max flow = residual graph

Nodes reachable from s (A) t

Cut edges come from V - A s t s t G G – G max flow = residual graph 4 10 2 2 7 10 7 s t s t 2 2 6 10 G G – G max flow = residual graph Cost of min cut = 4 + 7 + 2 + 6 = 19 = max flow value