Parallel Graph Algorithms (con4nued)

Similar documents
Parallel Graph Algorithms (con4nued)

CS 1501 Recitation. Xiang Xiao

Types of Networks. Internet Telephone Cell Highways Rail Electrical Power Water Sewer Gas

Graph Algorithms -2: Flow Networks. N. H. N. D. de Silva Dept. of Computer Science & Eng University of Moratuwa

1 Review for Lecture 2 MaxFlow

Flow Network. The following figure shows an example of a flow network:

Algorithms: Lecture 12. Chalmers University of Technology

Mathematics for Decision Making: An Introduction. Lecture 13

Algorithms and Theory of Computation. Lecture 11: Network Flow

Running Time. Assumption. All capacities are integers between 1 and C.

10 Max-Flow Min-Cut Flows and Capacitated Graphs 10 MAX-FLOW MIN-CUT

Maximum Flow. Jie Wang. University of Massachusetts Lowell Department of Computer Science. J. Wang (UMass Lowell) Maximum Flow 1 / 27

directed weighted graphs as flow networks the Ford-Fulkerson algorithm termination and running time

6.046 Recitation 11 Handout

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Internet Routing Example

Agenda. Soviet Rail Network, We ve done Greedy Method Divide and Conquer Dynamic Programming

Flows and Cuts. 1 Concepts. CS 787: Advanced Algorithms. Instructor: Dieter van Melkebeek

Maximum Flow. Reading: CLRS Chapter 26. CSE 6331 Algorithms Steve Lai

Con$nuous Op$miza$on: The "Right" Language for Fast Graph Algorithms? Aleksander Mądry

Lecture 2: Network Flows 1

CSE 326: Data Structures Network Flow. James Fogarty Autumn 2007

Max Flow: Algorithms and Applications

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Discrete Optimization 2010 Lecture 3 Maximum Flows

Algorithms: COMP3121/3821/9101/9801

Algorithm Design and Analysis

The maximum flow problem

CMPSCI 611: Advanced Algorithms

The max flow problem. Ford-Fulkerson method. A cut. Lemma Corollary Max Flow Min Cut Theorem. Max Flow Min Cut Theorem

7.5 Bipartite Matching

Maximum flow problem CE 377K. February 26, 2015

Soviet Rail Network, 1955

Maximum flow problem

Two Applications of Maximum Flow

The Max Flow Problem

We say that a flow is feasible for G (or just feasible if the graph and capacity function in question are obvious) if

Algorithms. Algorithms 6.4 MAXIMUM FLOW

Algorithms 6.4 MAXIMUM FLOW. overview Ford-Fulkerson algorithm analysis Java implementation applications

Breadth-First Search of Graphs

CSC 373: Algorithm Design and Analysis Lecture 12

Algorithms. Algorithms 6.4 MIN CUT / MAX FLOW

Discrete Optimization Lecture 5. M. Pawan Kumar

Lecture 21 November 11, 2014

Maximum flow problem (part I)

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

Discrete Optimization 2010 Lecture 2 Matroids & Shortest Paths

The min cost flow problem Course notes for Optimization Spring 2007

Basics on the Graphcut Algorithm. Application for the Computation of the Mode of the Ising Model

Preliminaries. Graphs. E : set of edges (arcs) (Undirected) Graph : (i, j) = (j, i) (edges) V = {1, 2, 3, 4, 5}, E = {(1, 3), (3, 2), (2, 4)}

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Network Flows. 4. Maximum Flows Problems. Fall 2010 Instructor: Dr. Masoud Yaghini

Energy minimization via graph-cuts

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Algorithm Design and Analysis

The min cost flow problem Course notes for Search and Optimization Spring 2004

Part V. Matchings. Matching. 19 Augmenting Paths for Matchings. 18 Bipartite Matching via Flows

(1,3) (3,4) (2,2) (1,2) (2,4) t

Problem set 1. (c) Is the Ford-Fulkerson algorithm guaranteed to produce an acyclic maximum flow?

22 Max-Flow Algorithms

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

Algorithm Design and Analysis

The Simplest and Smallest Network on Which the Ford-Fulkerson Maximum Flow Procedure May Fail to Terminate

An example of LP problem: Political Elections

Algorithm Design and Analysis

Lecture 3. 1 Polynomial-time algorithms for the maximum flow problem

Graphical Models. Lecture 10: Variable Elimina:on, con:nued. Andrew McCallum

Chapter 10. Maximum flow

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

CS 170 DISCUSSION 10 MAXIMUM FLOW. Raymond Chan raychan3.github.io/cs170/fa17.html UC Berkeley Fall 17

7. NETWORK FLOW II. bipartite matching disjoint paths extensions to max flow 3D Memory Reliability survey design airline scheduling image segmentation

Network Flows. CTU FEE Department of control engineering. March 28, 2017

GRAPH ALGORITHMS Week 7 (13 Nov - 18 Nov 2017)

Graphs and Network Flows IE411. Lecture 15. Dr. Ted Ralphs

Lecture 1. 1 Overview. 2 Maximum Flow. COMPSCI 532: Design and Analysis of Algorithms August 26, 2015

Symmetric chain decompositions of partially ordered sets

Standard Diraphs the (unique) digraph with no vertices or edges. (modulo n) for every 1 i n A digraph whose underlying graph is a complete graph.

CMPSCI 311: Introduction to Algorithms Second Midterm Exam

Network Flows made simple

CSC2420: Algorithm Design, Analysis and Theory Spring (or Winter for pessimists) 2017

Graphs and Network Flows IE411. Lecture 12. Dr. Ted Ralphs

2.13 Maximum flow with a strictly positive initial feasible flow

Maximum Integer Flows in Directed Planar Graphs with Multiple Sources and Sinks and Vertex Capacities

CSC2420: Algorithm Design, Analysis and Theory Fall 2017

Chemical Reaction Optimization for Max Flow Problem

Lecture 18: More NP-Complete Problems

The Maximum Flow Problem

CSCE423/823. Introduction. Flow Networks. Ford-Fulkerson Method. Edmonds-Karp Algorithm. Maximum Bipartite Matching 2/35 CSCE423/823.

Lecture 8 Network Optimization Algorithms

The partial inverse minimum cut problem with L 1 -norm is strongly NP-hard. Elisabeth Gassner

Undirected Graphs. V = { 1, 2, 3, 4, 5, 6, 7, 8 } E = { 1-2, 1-3, 2-3, 2-4, 2-5, 3-5, 3-7, 3-8, 4-5, 5-6 } n = 8 m = 11

FINAL EXAM PRACTICE PROBLEMS CMSC 451 (Spring 2016)

Algorithms, Graph Theory, and the Solu7on of Laplacian Linear Equa7ons. Daniel A. Spielman Yale University

Lecture 13: Polynomial-Time Algorithms for Min Cost Flows. (Reading: AM&O Chapter 10)

Review Questions, Final Exam

: Advanced Compiler Design Compu=ng DF(X) 3.4 Algorithm for inser=on of φ func=ons 3.5 Algorithm for variable renaming

University of Toronto Department of Electrical and Computer Engineering. Final Examination. ECE 345 Algorithms and Data Structures Fall 2016

Basics and Random Graphs con0nued

Chapter 7 Network Flow Problems, I

1 Matchings in Non-Bipartite Graphs

Transcription:

Parallel Graph Algorithms (con4nued)

MaxFlow A flow network G=(V,E): a directed graph, where each edge (u,v) E has a nonnega4ve capacity c(u,v)>=0. If (u,v) E, we assume that c(u,v)=0. Two dis4nct ver4ces : source s and sink t.

Find f: E -> R, such that Capacity constraint: For all u,v V, we require f(u,v) c( u,v) Flow conserva4on: For all u V\{s,t}, we require f ( e) = e. in. v e. out. v f ( e) Maximize f = f ( s, v) v V

A Long History Ini4ally defined by Ford and Fulkerson (196)

MaxFlow for sparse digraphs with m edges and integer capaci4es between 1 and C

Applica4ons Data mining. Open-pit mining. Bipar4te matching. Network reliability. Baseball elimina4on. Image segmenta4on. Network connec4vity. Distributed compu4ng. Security of sta4s4cal data. Egalitarian stable matching. Network intrusion detec4on. Mul4-camera scene reconstruc4on. Sensor placement for homeland security. Many, many, more.

Example: Matching Given an undirected graph G = ( V, E ) a subset of edges M E is a matching if each node appears in at most one edge in M. Max matching: Given a graph, find a max cardinality matching.

Bipar4te Matching A graph G is bipar4te if the nodes can be par44oned into two subsets L and R such that every edge connects a node in L to one in R Note that nodes 2,, 3 and 4 are not covered

Bipar4te Matching: Maxflow Formula4on Create digraph G = (L R {s, t}, E ). Direct all edges from L to R, and assign infinite (or unit) capacity. Add source s, and unit capacity edges from s to each node in L. Add sink t, and unit capacity edges from each node in R to t.

Solving MaxFlow: The Ford-Fulkerson method The Ford-Fulkerson method depends on three important ideas that transcend the method and are relevant to many flow algorithms and problems: residual networks, augmen4ng paths, and cuts. These ideas are essen4al to the important max-flow min-cut theorem, which characterizes the value of maximum flow in terms of cuts of the flow network.

FORD-FULKERSON-METHOD(G,s,t) ini4alize flow f to 0 while there exists an augmen*ng path p do augment flow f along p return f

Augmen4ng Paths Given a flow network and a flow, the residual network consists of edges that can admit more net flow. The amount of addi4onal net flow from u to v before exceeding the capacity c(u,v) is the residual capacity of (u,v), given by: c f (u,v)=c (u,v) - f (u,v) and in the other direc4on: c f (v, u)=c (v, u) + f (u, v). If f is a flow in G and f is a flow in the residual network G f then f + f is also a valid flow in G

Augmen4ng Paths Given a flow network G=(V,E) and a flow f, an augmen4ng path is a simple path from s to t in the residual network G f. Residual capacity of p : the maximum amount of net flow that we can ship along the edges of an augmen4ng path p, i.e., c f (p)=min{c f (u,v):(u,v) is on p}. 2 3 1 The residual capacity is 1

The basic Ford-Fulkerson algorithm FORD-FULKERSON(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 G f do c f (p) = min{c f (u,v): (u,v) is in p} for each edge (u,v) in p do f [u,v] = f [u,v]+c f (p)

Why for every edge (u,v) : (v,u)? 1 s t

Why for every edge (u,v) : (v,u)? 1 s t Augmented path with residual capacity = min(,,1) = 1

Why for every edge (u,v) : (v,u)? 1/ 1/ 1/1 s t Augmented path with residual capacity = min(4,,) = 4

Why for every edge (u,v): (v,u)? 1/ / 4/ 1/1 s t 4/ No Augmented Path possible anymore. OPTIMAL FLOW =????

For every edge (u,v) an addijonal (back)edge (v,u) with c(v,u) = f(u,v) s 0 1 0 0 0 0 0 0 t

For every edge (u,v) an addi4onal (back)edge (v,u) with c(v,u) = f(u,v) s 0 1 0 0 0 0 0 0 t Augmented path with residual capacity = min(,,1) = 1

For every edge (u,v) an addi4onal (back)edge (v,u) with c(v,u) = f(u,v) 1/ s 1/ 0/1 1/1 0/1 0 0/1 0 0 0 t Augmented path with residual capacity = min(4,,) = 4

For every edge (u,v) an addi4onal (back)edge (v,u) with c(v,u) = f(u,v) 1/ s / 0/1 1/1 0/ 4/ 0/4 0/1 0 0/4 0 4/ t Now SJll Augmented Paths POSSIBLE!!!!!!!!

For every edge (u,v) an addi4onal (back)edge (v,u) with c(v,u) = f(u,v) 1/4 s /0 0/1 1/1 0/ 4/ 0/4 0/1 0 0/4 0 4/ t Augmented path with residual capacity = min(,,1,1,1) = 1

For every edge (u,v) an addi4onal (back)edge (v,u) with c(v,u) = f(u,v) 1/ s /0 1/1 1/1 / 0/1 0/ 0/ t 1/ 0/1 1/ 0/1 0/ / MaxFlow = 6!!!!!!

For every edge (u,v) an addi4onal (back)edge (v,u) with c(v,u) = f(u,v) 0/ / 1/1 / s t 1/ 1/ / FINAL SOLUTION f + f

More Complex Execu4on In the following slides: (a)-(d) Successive itera4ons of the while loop: The lek side of each part shows the residual network G f from line 4 with a shaded augmen4ng path p. The right side of each part shows the new flow f that results from adding f p to f. The residual network in (a) is the input network G. (e) The residual network at the last while loop test. It has no augmen4ng paths, and the flow f shown in (d) is therefore a maximum flow.

Original Graph 16 v 1 12 v 3 20 s 10 4 9 7 t Residual Graph 12 13 v 2 v 4 14 4 4/12 New Flow 16 v 1 v 3 20 4/16 v 1 v 3 20 s 10 4 7 9 13 4 v 2 v 4 14 Augmented path with maximal residual flow of 4 t s 13 10 4 7 4/9 v 2 v 4 4/14 4/4 t (a)

Residual Graph s 12 v 1 v 3 4 4 10 4 4 13 10 v 2 v 4 4 8 7 20 4 t s 11/16 v 1 7/10 4 4/12 4/9 v 3 New Flow 7/20 7/7 t 13 4/4 v 2 v 4 11/14 Because there is a (forward) flow of 4 on this edge, there is a residual flow capacity of 4 on the back-edge, possibly nullifying the forward flow. The residual of 10 equals the capacity 14 the forward flow already established 4. (b) 28

Residual Graph s 13 11 v 1 3 11 8 4 4 3 v 3 v 2 v 4 11 7 7 13 4 8 was pushed on the back edges from v 1 to v 2 pushing 7 to the edge with capaci4es 7/10 resul4ng in (0/)10 and 1 was pushed to the edge with capaci4es (0/)4 resul4ng in 1/4. t s 11/16 8/13 v 1 10 1/4 12/12 4/9 v 3 v 2 v 4 11/14 New Flow 7/7 1/20 4/4 t (c) 29

s Original there was no edge (edge with capacity 0) going from v 2 to v 3, but because there was forward flow established on v 3 to v 2, the capacity of (v 2,v 3 ) was increased to 4!!!!! 12 12/12 v 1 v 3 11/16 v 1 v 3 19/20 11 4 11 3 7 1 t s 10 1/4 7/7 9 8 3 v 2 v 4 12/13 4/4 4 v 2 v 4 11 11/14 Residual Graph (d) New Flow The already established flow of 4 on edge (v 3,v 2 ) was nullified, thereby increasing the (residual) capacity on this edge to the original value of 9 t 30

Residual Graph NO AUGMENTED PATH FOUND v 1 12 v 3 1 s 1 11 3 9 7 19 t 12 3 v 2 v 4 11 4 (e) 31

The Edmonds-Karp algorithm A prac4cal implementa4on of Ford Fulkerson Find the augmen4ng path using breadth-first search. Breadth-first search gives the shortest path for graphs. (Assuming the length of each edge is 1.) Time complexity of Edmonds-Karp algorithm is O(VE 2 ). The proof is very hard and is not required here.

Rela4onship with Cut Sets A cut in a network with source s and sink t is a subset X V, such that s X and t X ( X, V\X ) is the set of edges from a vertex in X to a vertex in V\X The capacity of a cut X equals: C(X) = x (X,V \ X ) c(x) è For every flow f: E -> R and cut X, f C(X)

Max Flow == Min Cut Theorem 1: A flow in a network G is maximal iff there exists no augmen4ng path in G Theorem 2: The maximal flow in a network G equals the minimal capacity cut set of G Proof (sketch) Given that f is a maximal flow in G. Construct X such that s ε X, and for all v for which there exists an augmen4ng path from s to v: v ε X. Then t cannot belong to X, because there is no augmen4ng path anymore. So X is a proper cut of G. So C (X) = f and f <= C (Y) for any cut Y. So X is the minimal cut. The reverse follows trivially.

Push-Relabel Algorithm by Goldberg and Tarjan (JACM 1988) Note c (u,v) = the residual capacity of the back-edge of (u,v), so an edge going from v to u. The update of the remaining capacity of (u,v) is done on c(u,v)!!!

The labeling func4on h Only flow can be pushed from a node v to w if h(v) > h(w) Once raised, h(v) will never be decremented Ping Pong effects are avoided The algorithm will actually finish

Example

Excess flow is pushed to a

First h[a] is incremented to 1 and then excess flow is pushed from a to b and d

h[a] is incremented to 7!! then excess flow is pushed (back) from a to s

First h[b] is incremented to 1, then excess flow is pushed from b to c and t

First h[c] is incremented to 1, then excess flow is pushed from c to d

First h[d] is incremented to 1, then excess flow is pushed from d to t

b is the only node with excess > 0, b has no outgoing residual edges, so h[b] is incremented to 8 and b will push back excess flow to a

node a is the only ac4ve node with excess flow > 0 and will push flow back to s

A parallel version of push relabel