Network Flow CSE 373 Data Structures.

Slides:



Advertisements
Similar presentations
COMP 482: Design and Analysis of Algorithms
Advertisements

Lecture 5: Network Flow Algorithms Max-Flow Min-Cut Single-Source Shortest-Path (SSSP) Job Sequencing.
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.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
CSE 421 Algorithms Richard Anderson Lecture 23 Network Flow Applications.
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.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
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.
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
Chapter 7 April 28 Network Flow.
Chapter 7 May 3 Ford-Fulkerson algorithm Step-by-step walk through of an example Worst-case number of augmentations Edmunds-Karp modification Time complexity.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
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
Max-flow, Min-cut Network flow.
CS4234 Optimiz(s)ation Algorithms
Network flow problem [Adapted from M.Chandy].
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.
Lecture 22 Network Flow, Part 2
CSCI 3160 Design and Analysis of Algorithms Tutorial 8
Network Flow.
Max-flow, Min-cut Network flow.
CMSC 341 Lecture 24 Max Flow Prof. Neary
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
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 and Connectivity in Wireless Sensor Networks
7. Ford-Fulkerson Demo.
7. Ford-Fulkerson Demo.
Flow Networks Topics Flow Networks Residual networks
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 21 Network Flow
Max Flow Min Cut, Bipartite Matching Yin Tat Lee
Augmenting Path Algorithm
Flow Networks and Bipartite Matching
Algorithms (2IL15) – Lecture 7
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
Richard Anderson Lecture 22 Network Flow
Lecture 21 Network Flow, Part 1
Maximum Flow Neil Tang 4/8/2008
7. Ford-Fulkerson Demo.
7. Ford-Fulkerson Demo.
7. Ford-Fulkerson Demo.
7. Ford-Fulkerson Demo.
Lecture 22 Network Flow, Part 2
Network Flow.
7. Ford-Fulkerson Demo.
Richard Anderson Lecture 22 Network Flow
7. Ford-Fulkerson Demo.
Maximum Flow Problems in 2005.
7. Ford-Fulkerson Demo 02/25/19 Copyright 2000, Kevin Wayne.
Presentation transcript:

Network Flow CSE 373 Data Structures

Sources and Sinks S T 4/7/2019 CSE 373 AU 2005 -- Network Flow

Flow Conservation 14 + 10 = 6 + 11 + 7 6 14 11 10 7 4/7/2019 CSE 373 AU 2005 -- Network Flow

Capacities/Saturation 7/9 T 7/10 7/7 7/11 flow / capacity 4/7/2019 CSE 373 AU 2005 -- Network Flow

Flow Cancellation 8 5 = 3 4/7/2019 CSE 373 AU 2005 -- Network Flow

Max Flow? A 0/12 B 0/20 0/16 0/4 S T 0/10 0/7 0/9 0/13 0/4 C D 0/14 4/7/2019 CSE 373 AU 2005 -- Network Flow

A Flow A 12/12 B 19/20 11/16 1/4 S T 0/10 7/7 0/9 12/13 4/4 C D 11/14 4/7/2019 CSE 373 AU 2005 -- Network Flow

A Flow saturated 12 + 7 = 19 + 0 A 12/12 B 19/20 11/16 1/4 S T 0/10 7/7 0/9 saturated 12/13 4/4 saturated C D 11/14 12 + 0 + 0 = 1 + 11 4/7/2019 CSE 373 AU 2005 -- Network Flow

Cuts 23/29 A 12/12 B 19/20 11/16 1/4 S T 0/10 7/7 0/9 12/13 4/4 C D 11/14 Remove edges until S is in one connected component, and T in the other 23/29 4/7/2019 CSE 373 AU 2005 -- Network Flow

Cuts 23/26 A 12/12 B 19/20 11/16 1/4 S T 0/10 7/7 0/9 12/13 4/4 C D 11/14 23/26 Only count forward edges 4/7/2019 CSE 373 AU 2005 -- Network Flow

Cuts 23/31 A 12/12 B 19/20 11/16 1/4 S T 0/10 7/7 0/9 12/13 4/4 C D 11/14 23/31 4/7/2019 CSE 373 AU 2005 -- Network Flow

Min Cut 23/23 A 12/12 B 19/20 11/16 1/4 S T 0/10 7/7 0/9 12/13 4/4 C D 11/14 23/23 4/7/2019 CSE 373 AU 2005 -- Network Flow

Max Flow = Min Cut 23 23 A 12/12 B 19/20 11/16 1/4 S T 0/10 7/7 0/9 12/13 4/4 C D 11/14 No more capacity along cut to take more flow 4/7/2019 CSE 373 AU 2005 -- Network Flow

Ford-Fulkerson Method Single source, single sink Several algorithms are implementations of this method Requires integer capacities for steady progress Fastest implementation computes max flow in O(V^3) time 4/7/2019 CSE 373 AU 2005 -- Network Flow

Ford-Fulkerson Method Initialize flow f to 0 While there exists an augmenting path p Augment flow f along p Return f 4/7/2019 CSE 373 AU 2005 -- Network Flow

An Augmenting Path How much can be sent along the path? A 0/12 B 0/20 0/16 0/4 S T 0/10 0/7 0/9 0/13 0/4 C D 0/14 How much can be sent along the path? 4/7/2019 CSE 373 AU 2005 -- Network Flow

An Augmenting Path Find a path with DFS or BFS. bottleneck A 12/12 B 12/20 12/16 0/4 S T 0/10 0/7 0/9 0/13 0/4 C D 0/14 Find a path with DFS or BFS. 4/7/2019 CSE 373 AU 2005 -- Network Flow

Another Augmenting Path 12/12 B 12/20 12/16 0/4 S T 0/10 0/7 0/9 0/13 0/4 C D 0/14 How much can be sent along the path? 4/7/2019 CSE 373 AU 2005 -- Network Flow

Another Augmenting Path 12/12 B bottleneck 12+4=16/20 12+4=16/16 0/4 S T 4/10 4/7 0/9 0/13 0/4 C D 4/14 How much can be sent along the path? 4/7/2019 CSE 373 AU 2005 -- Network Flow

Residual Graphs How much more flow can be sent? 4/12 A B 4/16 0/20 0/4 0/10 0/7 4/9 0/13 4/4 C D 4/14 12-4=8 A B 4 16-4=12 20 4 4 S T 10 4 7 9-4=5 13 4 4 C D 4/7/2019 CSE 373 AU 2005 -- Network Flow 14-4=10 How much more flow can be sent?

Residual Graphs S A C B D T 4/16 0/13 0/10 0/4 4/9 4/14 4/12 0/20 0/7 4/4 8 A B 4 12 20 4 4 S T 10 4 7 5 13 4 S A C B D T 4/16 4/13 0/10 0/4 0/9 4/14 4/12 4/20 0/7 4/4 4 C D 10 8 A B 4 12 16 4 4 4 S T 10 7 9 4 9 4 Can cancel out flow (BC) 4/7/2019 CSE 373 AU 2005 -- Network Flow 4 C D 10

Residual Graphs S A C B D T 4/16 0/13 0/10 0/4 4/9 4/14 4/12 0/20 0/7 4/4 8 A B 4 12 12 4 4 4 S T 10 7 9 4 9 4 12/12 4 A B C D 12/16 12/20 10 0/4 0/10 S T 0/7 0/9 A B 4/13 12 4/4 C D 4 8 4/14 12 12 4 S T 10 7 9 4 9 4 4/7/2019 CSE 373 AU 2005 -- Network Flow 4 C D 10

Residual Graphs S A C B D T 4/16 0/13 0/10 0/4 4/9 4/14 4/12 0/20 0/7 4/4 A B 12 4 8 12 12 4 S T 10 7 9 4 9 4 12/12 4 A B C D 12/16 10 19/20 0/4 0/10 S T 7/7 0/9 A B 11/13 12 4/4 C D 4 1 11/14 19 12 4 S T 10 7 9 11 2 4 4/7/2019 CSE 373 AU 2005 -- Network Flow 11 C D 3

Residual Graphs 12/12 A B 12/16 19/20 0/4 0/10 S T 7/7 0/9 11/13 4/4 C 11/14 A B 12 4 1 19 12 4 S T 10 7 9 11 2 4 11 C D 3 No more augmenting paths: Max Flow! Reachable vertices from source form one set, other vertices the other set. Edges in the middle are the cut. 4/7/2019 CSE 373 AU 2005 -- Network Flow

Linear Programming: Max Flow Variables: SA, SB, AB, AT, BT (amount of flow through the edge) Constraints: capacity 0 <= SA, SB, AB, AT, BT SA <= 16 SB <= 13 AB <= 10 AT <= 4 BT <= 20 flow conservation AS = AB + AT AB + SB = BT Objective: max ( SA + SB + AB + AT + BT ) A 0/4 0/16 S T 0/10 0/13 B 0/20 4/7/2019 CSE 373 AU 2005 -- Network Flow

Linear Programming: Min Cut Variables: SA, SB, AB, AT, BT (not cut = 0, cut = 1) AinS, BinS (not in S = 0, in S = 1) Constraints: 0 <= SA, SB, AB, AT, BT 1 <= SA + AinS (A in S or SA is cut) 1 <= SB + BinS (B in S or SB is cut) 0 <= AB - AinS + BinS (A in S but not B means AB is cut) 0 <= AT - AinS (A in S means AT is cut) 0 <= BT - BinS (B in S means BT is cut) Objective: min (16 SA + 4 AT + 10 AB + 13 SB + 20 BT) A 0/4 0/16 S T 0/10 0/13 B 0/20 4/7/2019 CSE 373 AU 2005 -- Network Flow