Flow Networks and Bipartite Matching

Slides:



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

1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
The Maximum Network Flow Problem. CSE Network Flows.
Advanced Algorithm Design and Analysis (Lecture 8) SW5 fall 2004 Simonas Šaltenis E1-215b
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.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 4 Tuesday, 10/2/01 Graph Algorithms: Part 2 Network.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Lecture 5 Wednesday, 10/6/04 Graph Algorithms: Part 2.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Maximum Flow Chapter 26.
Theory of Computing Lecture 13 MAS 714 Hartmut Klauck.
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.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Data Structures & Algorithms Network Flow Richard Newman based on book by R. Sedgewick.
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.
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
Contest Algorithms January 2016 Describe the maxflow problem, explain the Ford-Fulkerson, Edmonds-Karp algorithms. Look at the mincut problem, bipartite.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Maximum Flow Chapter 26.
The Maximum Network Flow Problem
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.
Maximum Flow Chapter 26.
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
BIPARTITE GRAPHS AND ITS APPLICATIONS
Graph Algorithms Minimum Spanning Tree (Chap 23)
Algorithms and Networks Hans Bodlaender
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
Max Flow min Cut.
ADVANCED ALGORITHMS GRAPH ALGORITHMS (UNIT-2).
Max-flow, Min-cut Network flow.
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.
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
Lecture 5 Tuesday, 3/2/10 Graph Algorithms: Part 2
Flow Networks General Characteristics Applications
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
Network Flow.
Lecture 21 Network Flow, Part 1
Dinitz's algorithm for finding a maximum flow in a network.
MAXIMUM flow by Eric Wengert.
Richard Anderson Lecture 22 Network Flow
Maximum Flow Neil Tang 4/8/2008
Lecture 22 Network Flow, Part 2
Network Flow.
Maximum Bipartite Matching
Advanced Graph Homer Lee 2013/10/31.
Presentation transcript:

Flow Networks and Bipartite Matching Alexandra Stefan

Flow Network v1 v3 v1 v3 s t s t v2 v4 v2 v4 A flow network is a directed graph G = (V,E) in which each edge, (u,v) has a non-negative capacity, c(u,v) ≥ 0, and for any pair of vertices (u,v) it has only one edge (it does not have edges in both directions: both (u,v) and (v,u)). 2 special vertices: source, s, and sink, t. Applications: Shipping network, Internet network A flow in G is a function f:VxV -> R, s.t.: Capacity constraint: for any two vertices u,v, 0 ≤ f(u,v) ≤ c(u,v) Flow conservation: for each 𝑢∈𝑉−{𝑠,𝑡}: 𝑣∈𝑉 𝑓 𝑣,𝑢 = 𝑣∈𝑉 𝑓(𝑢,𝑣) Goal: find a maximum flow through G. Give maximum flow example: 15 15 v1 v3 v1 v3 20 20 10 10 17 s 8 17 14 t s 8 14 t 30 30 6 6 v2 v4 v2 v4 22 22

Ford-Fulkerson Method Ford-Fulkerson-Method(G,s,t) Initialize flow f to 0 While there exists an augmenting path , p, in the residual network Gf, augment flow f along p Return f Residual graph Gf: Augmenting path: a path in Gf from s to t.

Ford-Fulkerson Method Work sheet Graph, G, and current flow, f. Residual graph, Gf 15/ v1 v3 v1 v3 20/ 10/ s 8/ 17/ 14/ t s t 30/ 6/ v2 v4 v2 v4 22/

Additional properties for a flow network: No self loops. Every vertex, v, is on a path from s to t => connected and |E| ≥ |V|-1 Antiparallel edges Edges in both directions: (u,v) and (v,u)

Variations Multiple source and multiple sink nodes: Add one extra source and one extra sink Antiparallel edges exist: If both (u, v) and (v, u): Add vertex v’, Replace edge (v,u) with edges (v, v’) and (v’, u). u u v’ v v

Max-Flow Min-Cut Theorem If f is a flow in a flow network G = (V,E) with source s and sink t, then the following conditions are equivalent: f is a maximum flow in G. The residual network Gf contains no augmenting paths. |f| = c(S,T) for some cut (S,T) of G. c(S,T) is the sum of flows on edges from S to T minus the sum of flows on edges from T to S.

Time Complexity Analysis If the flow has real values, the algorithm may never terminate. Worst case: O(E |f*|) (f* - maximum flow) In Gf, pick paths that use the small-capacity edges: (u,v) and, when available (v,u). v 1000 1000 s 1 t 1000 1000 u

Edmonds-Karp Algorithm In the residual graph, pick as augmenting path the shortest path from s to t (given by breadth-first search when all edges have weight 1). Time complexity of Edmonds-Karp algorithm: O(VE2) Intuition: Finding the augmenting path takes O(E) (due to BFS) Each edge can become critical at most O(V) times. There are O(E) edges in the residual graph.

Bipartite Matching L R p1 p1 j1 j1 p2 p2 j2 j2 s t p3 p3 j3 j3 p4 p4 Bipartite undirected graph, G = (V,E): V = L ∪ R All edges are between L and R. Model dependencies: Employees and Jobs Resources and processes Goal: maximize pairing vertices E.g. assign employees s.t. maximum number of jobs is done. Solved with maximum-flow Add extra source and sink nodes Put capacity of 1 on all edges Solve for maximum flow. Corresponding flow network (with capacity 1 for each edge) L R p1 p1 1 j1 j1 1 1 p2 p2 1 1 j2 j2 s 1 t 1 1 p3 p3 1 1 j3 1 j3 p4 p4 Bipartite graph

Work sheet v1 v3 s t v2 v4