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.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
MAX FLOW APPLICATIONS CS302, Spring 2013 David Kauchak.
Network Optimization Models: Maximum Flow Problems
1 Maximum Flow 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 
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
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.
MAX FLOW CS302, Spring 2013 David Kauchak. Admin.
Maximum Flow Chapter 26.
Network Flow How to solve maximal flow and minimal cut problems.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
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.
MAX FLOW APPLICATIONS CS302, Spring 2012 David Kauchak.
Max Flow – Min Cut Problem. Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material.
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
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.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 14, 2014.
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 Chapter 26.
Shortest Paths.
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.
Finding a Path With Largest Smallest Edge
CS4234 Optimiz(s)ation Algorithms
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
December 1st – Graph Madness
Network Flow.
Max Flow min Cut.
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
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Network Flow and Connectivity in Wireless Sensor Networks
Lecture 10 Network flow Max-flow and Min-cut Ford-Fulkerson method
Shortest Paths.
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 21 Network Flow
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
Text Book: Introduction to algorithms By C L R S
Lecture 21 Network Flow, Part 1
MAXIMUM flow by Eric Wengert.
Richard Anderson Lecture 22 Network Flow
Shortest Paths.
Lecture 21 Network Flow, Part 1
Maximum Flow Neil Tang 4/8/2008
Special Graphs: Modeling and Algorithms
Network Flow.
Maximum Bipartite Matching
Richard Anderson Lecture 22 Network Flow
Presentation transcript:

Network Flow

Graph for Network Flow Source(s) – nodes with no incoming edge Sink(s) – nodes with no outgoing edge Edges in graph – no parallel edges Indicate maximum capacity that can flow through that edge Could be directed or not Max Flow: what is the maximum amount that can flow from the source to the sink? Min Cut: what is a cut through edges to partition the graph into two, where the sum of cut edges is minimized?

Floyd Fulkerson Max Flow Algorithm Basic idea: Find a path from source to sink Find minimum edge weight on that path Reduce all edges on path by that weight, add that amount to total flow BUT, this greedy strategy does not completely work! So, each time we reduce edge weights, we add (or increase weight of) a reverse edge showing “residual” capacity i.e. how much capacity could flow backward along that edge compared to best so far Now, can follow algorithm to completion

Max Flow: 19 4 10 10 2 8 6 10 10 9 Example from course found at algo.is

Greedy only (no new back edges) Total Flow: 0 4 10 10 2 8 6 10 10 9

Greedy only (no new back edges) Total Flow: 8 4 10 2 2 6 2 10 9

Greedy only (no new back edges) Total Flow: 8 4 10 2 2 6 2 10 9

Greedy only (no new back edges) Total Flow: 10 4 10 6 10 7

Greedy only (no new back edges) Total Flow: 10 4 10 6 10 7

Greedy only (no new back edges) Total Flow: 16 We are stuck, but max was 19! 4 4 4 1

Floyd Fulkerson Total Flow: 0 4 10 10 2 8 6 10 10 9

Floyd Fulkerson Total Flow: 8 4 10 2 8 2 6 8 8 2 10 9

Floyd Fulkerson Total Flow: 10 4 10 10 2 6 8 10 10 7 2

Floyd Fulkerson Total Flow: 16 4 4 10 6 2 6 8 10 6 4 1 8

Floyd Fulkerson Total Flow: 18 2 2 2 10 8 6 2 8 10 8 2 1 8

Floyd Fulkerson Total Flow: 19 1 1 3 10 9 1 6 2 7 10 9 1 9

Creating good implementations Want to try to pick good paths, or it can take a while to solve Fewest number of edges (Floyd Fulkerson) Large bottleneck capacity For bottleneck (wanting “good” but not “best” route): Can keep a “scale” factor: eliminate all edges from the residual graph that have weight less than the scale factor. Ensures only paths that are “large enough” are found. Decrease scale factor (e.g. by factor of 2) if nothing found – eventually scale gets down to 1 (minimum edge capacity), so you are solving the whole thing.

Edmonds Karp: Improving Floyd Fulkerson Idea is to use BFS to find the fewest edges needed to get from source to sink. Avoids problems where you follow the same link in opposite direction each time (and only increase flow by a small amount) will tend to get more flow more quickly Only needs to be run O(VE) times See book for an implementation Another improvement: Dinic’s Algorithm

Min Cut What is the smallest combined weight of edges we’d have to cut to separate the source from the sink? This is computed as a byproduct of Max Flow After computing max flow, the set of vertices reachable from source is one set, the remainder are the other set The min cut is all edges from the reachable set to the non-reachable set. The cut weight will equal the max flow!

Results after Max Flow – reachable from source 1 Not Reachable 1 3 10 9 1 6 2 7 10 9 1 Reachable 9

Edges to cut are those from reachable to non-reachable – weight is same as max flow (19) Not Reachable 4 10 10 2 8 6 10 10 9 Edges from Reachable to Not Reachable Reachable

Variations: Multi-source/multi-sink Vertex capacities Create a “super source” and “super sink” that have edges going to all sources or from all sinks. Capacity of these is infinite Then, just run from super-source to super-sink Vertex capacities If limits at the vertices, split vertices in two, A and B A gets all incoming edges B gets all outgoing edges One edge from A to B with capacity equal to vertex capacity