Flow Networks Ching-Chen Huang Hsi-Yue Hsiao. CONTENTS Network flows on directed acyclic graphs Ford-fulkerson Algorithms -Residual networks.

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)
Maximum Flow Computation Programming Puzzles and Competitions CIS 4900 / 5920 Spring 2009.
The Maximum Network Flow Problem. CSE Network Flows.
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
Advanced Algorithm Design and Analysis (Lecture 8) SW5 fall 2004 Simonas Šaltenis E1-215b
Chapter 26 of CLSR Maximum Network Flow by me Dr. M. Sakalli Ch26 of CSLR and many other sources. Marmara Univ. Picture taken from without permission.
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.
1 Optimization Spring 2007 (Third Quarter). 2 Some practical remarks Homepage: Exam: Written, 3 hours. There.
Optimisation Methods Network Models.
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.
Chapter 27 Maximum Flow Maximum Flow Problem The Ford-Fulkerson method m bipartite matching.
Flows sourcesink s t Flows sourcesink edge-weights = capacities.
COMS Network Theory Week 6: February 28, 2008 Dragomir R. Radev Thursdays, 6-8 PM 233 Mudd Spring 2008.
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, 2006 Lecture 5 Wednesday, 10/4/06 Graph Algorithms: Part 2.
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.
MAX FLOW CS302, Spring 2013 David Kauchak. Admin.
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).
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.
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.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Chapter 26 of CLSR Maximum Network Flow by me Dr. M. Sakalli from Ch26 of CSLR and many other sources. Marmara Univ.
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.
CSE 421 Algorithms Richard Anderson Lecture 21 Shortest Paths and Network Flow.
Instructor Neelima Gupta Edited by Divya Gaur(39, MCS '09) Thanks to: Bhavya(9), Deepika(10), Deepika Bisht(11) (MCS '09)
The Maximum Network Flow Problem
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Network Flow What is a network? Flow network and flows
Maximum Flow Chapter 26.
The Maximum Network Flow Problem
Maximum Flow Chapter 26.
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Graph Algorithms Minimum Spanning Tree (Chap 23)
Network flow problem [Adapted from M.Chandy].
CSCI 3160 Design and Analysis of Algorithms Tutorial 8
ADVANCED ALGORITHMS GRAPH ALGORITHMS (UNIT-2).
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 21 Network Flow
Network Flows and Matching (Supplementary)
Flow Networks General Characteristics Applications
Flow Networks and Bipartite Matching
Algorithms (2IL15) – Lecture 7
Network Flow CSE 373 Data Structures.
EE5900 Advanced Embedded System For Smart Infrastructure
Lecture 21 Network Flow, Part 1
Presentation transcript:

Flow Networks Ching-Chen Huang Hsi-Yue Hsiao

CONTENTS Network flows on directed acyclic graphs Ford-fulkerson Algorithms -Residual networks

Network flows on directed acyclic graphs DAG is a directed graph with no cycles. Flow network: a flow network G = (V,E) is a directed graph in which each edge (u,v) ∈ E has a nonnegative capacity c(u,v) >= 0. if (u,v) ∉ E, we assume that c(u,v) = 0. st We distinguish two vertices in flow network, source s and sink t. The source produces the material at a steady rate. The sink consumes the material at a steady rate. Objective : how much of material can be imposed through the network that it can handle.

Flow: A flow in G is a real-valued function f : V × V → R that satisfies three properties: 1. Capacity constraint : For all u,v ∈ V, we require f(u,v) ≤ c(u,v). The net flow from one vertex to another must not exceed the given capacity. 2. Skew symmetry : For all u,v ∈ V, we require f(u,v) = -f(v,u). The net flow from a vertex u to a vertex v is the negative of the net flow in the 3. Flow conservation : For all u ∈ V - {s,t}, we require ∑ f(u,v) = 0. v ∈ V The quantity f(u,v),which can be positive or negative, is called the net flow from vertex u to v. The value of the flow is defined as | f | = ∑ f(s,v) that is the totat net v ∈ V Flow out of the source.

Residual Capacity Given a flow f in network G = (V, E). Consider a pair of vertices u, v ∈ V. Residual capacity:  The amount of additional flow we can push directly from u to v.  c f (u, v) = c(u, v)  f (u, v) ≥ 0 (since f (u, v) ≤ c(u, v)) Example:  c(u,v) = 16, f(u,v) = 5  c f (u, v) = 11

Residual Network Residual network: G f = (V, E f ), E f = {(u, v) ∈ V × V : c f (u, v) > 0}. Each edge of the residual network can admit a positive flow. Given flows f 1 and f 2, the flow sum f 1 + f 2 is  (f 1 + f 2 )(u, v) = f 1 (u, v) + f 2 (u, v) for all u, v ∈ V.

Consider the network G=(V,E) shown in the figure below. Each edge (u,v) ∈ E in the network is labeled with its capacity c(u,v). s b t a s b t a Flow:

Residual graph s b t a s b t a 5 1/4 1/3 1/1 2/2

Residual graph s b t a s b t a 1/5 2/4 1/3 0/1 2/2

s b t a s b t a 3/5 2/4 3/3 1 2/2

s b t a Max Flow : 5

Ford-Fulkerson Algorithm The Ford_Fulkerson method is iterative, Starts with f(u,v) for (u,v) ∈ V, initial flow of value 0. The method is based on the augmenting path which is defined as a path from s to t along which we can push more flow and then augment flow along this path.

Procedure Ford_Fulkerson_method(G,s,t): For each edge (u,v) ∈ E[G] do f[u,v]  0 f[v,u]  0 While there exists a path p from s to t in the residual network G1 do c1(p)  min{ c1(u,v):(u,v) is in p} for each edge (u,v) in p do f[u,v]  f[u,v] + c1(p) f[u,v]  -f[u,v]

Running time for this algorithms is O(E * |f*|) where f* is the maximum flow found by algorithm. First three Lines take time θ(E). The while loop of last five lines is executed at most |f*| times, since the flow value increases by at least one unit in each iteration.

Ford-Fulkerson Algorithm Ford-Fulkerson(G, s, t) ; G = (V, E) 1 for each edge (u,v) in E 2 f(u,v) = f(v,u) = 0 3 while exists path p from s to t in residual network G f 4 do c f (p) = min{c f (u, v) : (u, v) is in p} 5 for each edge (u,v) on p 6 f(u,v) = f(u,v) + c f (p) 7 f(v,u) = -f(u,v)

st v1v2 v4v st v1v2 v4v3 13 4/16 4/ /14 4/ /9 7 7 Example:

st v1v2 v4v st v1v2 v4v /16 7/20 11/14 4/4 7/10 4 4/9 7/7 4/12 4

st v1v2 v4v st v1v2 v4v3 8/13 11/16 15/20 11/14 4/4 10 1/4 4/9 7/7 12/12

st v1v2 v4v s v1v2 v4v3 12/13 11/16 11/14 4/4 10 1/4 9 7/7 12/12 t 19/20

st v1v2 v4v

Reference Class Notes from Dr. Istvan Jonyer of Oklahoma State University Class Notes from CSE 5311 of 2004, made by Hiren Patel, Ujjval Patel