CS 138b Computer Algorithm Homework #14. Ling Li, February 23, Construct the level graph

Similar documents
5 Flows and cuts in digraphs

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

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

Algorithms and Theory of Computation. Lecture 11: Network Flow

7.5 Bipartite Matching

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

Lecture 2: Network Flows 1

Two Applications of Maximum Flow

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

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

CSC 373: Algorithm Design and Analysis Lecture 12

Lecture 21 November 11, 2014

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)}

Introduction to Graph Theory

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

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

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

CMPSCI 611: Advanced Algorithms

6.046 Recitation 11 Handout

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

Lecture 13 Spectral Graph Algorithms

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

Algorithms: COMP3121/3821/9101/9801

Maximum flow problem (part I)

ACO Comprehensive Exam March 20 and 21, Computability, Complexity and Algorithms

Recall: Matchings. Examples. K n,m, K n, Petersen graph, Q k ; graphs without perfect matching

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

ACO Comprehensive Exam March 17 and 18, Computability, Complexity and Algorithms

Algorithms Booklet. 1 Graph Searching. 1.1 Breadth First Search

M-saturated M={ } M-unsaturated. Perfect Matching. Matchings

Bipartite Matchings and Stable Marriage

Week 4. (1) 0 f ij u ij.

Algorithm Design and Analysis

Four-coloring P 6 -free graphs. I. Extending an excellent precoloring

Breadth First Search, Dijkstra s Algorithm for Shortest Paths

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

8.5 Sequencing Problems

Breadth-First Search of Graphs

Duality of LPs and Applications

1 Some loose ends from last time

Math 775 Homework 1. Austin Mohr. February 9, 2011

Fundamental Algorithms 11

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

IS 709/809: Computational Methods in IS Research Fall Exam Review

Fall 2017 Qualifier Exam: OPTIMIZATION. September 18, 2017

BBM402-Lecture 20: LP Duality

ORIE 633 Network Flows October 4, Lecture 10

Maximum flow problem

Dynamic Programming: Shortest Paths and DFA to Reg Exps

On a list-coloring problem

Powerful tool for sampling from complicated distributions. Many use Markov chains to model events that arise in nature.

Vertex-Coloring Edge-Weighting of Bipartite Graphs with Two Edge Weights

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

Notes on Graph Theory

- Well-characterized problems, min-max relations, approximate certificates. - LP problems in the standard form, primal and dual linear programs

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

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

Graph G = (V, E). V ={vertices}, E={edges}. V={a,b,c,d,e,f,g,h,k} E={(a,b),(a,g),( a,h),(a,k),(b,c),(b,k),...,(h,k)}

1 Matchings in Non-Bipartite Graphs

Observation 4.1 G has a proper separation of order 0 if and only if G is disconnected.

Observation 4.1 G has a proper separation of order 0 if and only if G is disconnected.

A lower bound for the Laplacian eigenvalues of a graph proof of a conjecture by Guo

Algorithm Design and Analysis

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

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

Lexicographic Flow. Dexter Kozen Department of Computer Science Cornell University Ithaca, New York , USA. June 25, 2009

Dynamic Programming: Shortest Paths and DFA to Reg Exps

Algorithms: Lecture 12. Chalmers University of Technology

Ma/CS 6b Class 3: Stable Matchings

INVERSE SPANNING TREE PROBLEMS: FORMULATIONS AND ALGORITHMS

Upper Bounds of Dynamic Chromatic Number

10725/36725 Optimization Homework 2 Solutions

Constructive proof of deficiency theorem of (g, f)-factor

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

2.13 Maximum flow with a strictly positive initial feasible flow

1 The Local-to-Global Lemma

List of Theorems. Mat 416, Introduction to Graph Theory. Theorem 1 The numbers R(p, q) exist and for p, q 2,

6. Linear Programming

. CS711008Z Algorithm Design and Analysis. Lecture 10. Algorithm design technique: Network flow and its applications 1. Dongbo Bu

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

ON TWO QUESTIONS ABOUT CIRCULAR CHOOSABILITY

Advanced Combinatorial Optimization Updated April 29, Lecture 20. Lecturer: Michel X. Goemans Scribe: Claudio Telha (Nov 17, 2009)

Classical Complexity and Fixed-Parameter Tractability of Simultaneous Consecutive Ones Submatrix & Editing Problems

A necessary and sufficient condition for the existence of a spanning tree with specified vertices having large degrees

Low-density parity-check (LDPC) codes

CS 301: Complexity of Algorithms (Term I 2008) Alex Tiskin Harald Räcke. Hamiltonian Cycle. 8.5 Sequencing Problems. Directed Hamiltonian Cycle

On shredders and vertex connectivity augmentation

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

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT

1 Review for Lecture 2 MaxFlow

Internet Routing Example

Vector Spaces. Addition : R n R n R n Scalar multiplication : R R n R n.

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

Soviet Rail Network, 1955

Chapter 9: Relations Relations

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.

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

Fast Approximation of Maximum Flow using Electrical Flows

Combinatorial Optimization

Realization of set functions as cut functions of graphs and hypergraphs

Transcription:

14.1 Construct the level graph Let s modify BFS slightly to construct the level graph L G = (V, E ) of G = (V, E, c) out of a source s V. We will use a queue Q and an array l containing levels of vertices. Initialize. Q = [s]; Allocate n units for l, where n = V ; l(s) = 0 and l(u) = 1 for all other vertices; V = {s}, E =. Advance. u := pop(q). (u, v) E: if l(v) < 0, l(v) := l(u) + 1, push(q, v), V = V {v}, E = E {(u, v)}. Repeat Advance until Q is empty. The time for Initialize is O(n). In Advance, any vertex requires at most 1 pair of push/pop operation, and other operations are performed at most once for every edge. Thus the time is O(m + n). The total running time is O(m + n). 1

14.2 Binary capacities Apply Dinic s algorithm to G. I want to show that if all capacities of G are 0 or 1, the time complexity is O(mn). Below the bold font refers to operations in Dinic s algorithm. When all capacities are 0 or 1, all edges in a path flow are saturated thus will all be deleted in Augment. Thus in one phase, each edge of G will be operated by Advance, Retreat and Augment at most once (totally at most 3 operations). And in Retreat, a vertex is deleted with its edges, so no more than O(m) time is needed. Together with the O(m) time needed for Initialize, the total time for one phase is still O(m). Because there are at most n phases, the total time is O(mn). 2

14.3 König-Egerváry theorem For any matching of size k and any cover with size k in A, we have k k. This is because any pair {i l, j l } in the matching needs a row or column to cover, and those rows and columns must be distinct since all i l are distinct and all j l are distinct. Thus k max k min, where k max is the maximum size of a matching and k min is the least size of a cover. Consider A as the adjacency matrix of a bipartite graph G = (U, V, E), with U = {u i }, V = {v j }, and a directed edge (u i, v j ) E iff A i,j = 1. Thus the vertices in set U correspond to rows in A and the vertices in set V correspond to rows in B. Add a new source vertex s and a new sink vertex t, connect s to every vertex in U, and connect every vertex in V to t. Assign every edge capacity 1. Thus we get a capacitated graph G. Any integral flow f in G corresponds to a matching in A, if we take every edge (u i, v j ) used by f as a pair {i, j} in the matching. Conversely, any matching in A corresponds to an integral flow in G. Therefore, k max = f max = c(b 1, B 2 ), where f max is a max flow and B 1, B 2 a min cut in G. Without loss of generality, assume s B 1 and t B 2. Let U i = B i U and V i = B i V. Then B 1 = {s} U 1 V 1 and B 2 = {t} U 2 V 2. We can construct a cover in A from B 1, B 2 as follows. Let R = {row i : u i U 1 and v V 2 so that c(u i, v) = 1, or u i U 2 } and C = {column j : v j V 1 }. Since for any pair {i, j} for which A i,j = 1, we have c(u i, v j ) = 1. If v j V 1, then column j C; If v j V 2, then row i R. Thus R C is a cover in A. The size of this cover is R + C U 2 + V 1 + c(u, v). u U 1,v V 2 From c(b 1, B 2 ) = u B 1,v B 2 c(u, v) = u U 2 c(s, u) + v V 1 c(v, t) + = U 2 + V 1 + and k min is the least size of the cover, we observe So finally we get k max = k min. u U 1,v V 2 c(u, v), k min c(b 1, B 2 ) = k max. u U 1,v V 2 c(u, v) (In fact, we can construct the min cut B 1, B 2 by let B 1 contain all the vertices that can be visited from s in the residual graph of f max in G. Then u U 1,v V 2 c(u, v) must be 0 and thus c(b 1, B 2 ) = R + C. This can be proved by contradiction. If there is an edge (u, v) with u U 1, v V 2, and c(u, v) = 1, then (u, v) is also in the residual graph, otherwise there is a flow through (u, v) and then u B 1. Thus v can also be reached from s, which contradicts with v B 2.) 3

14.4 Max flow with a sequence of augmenting paths Let f be a max flow in G. By Lemma 17.4 in Kozen s book, f can be expressed as a sum of k (k E ) path flows in G (denoted by p i, i = 1, 2,..., k) and a flow in G of value 0. For i = 0, 1,..., k, define flow f i = i p j. j=1 Then f 0 is a null flow, and f k = f, f k is a max flow in G. By the construction of p i (in the proof of Lemma 17.4) and f 0, the value of p i is always positive. Together with f i = f i 1 + p i is still a flow in G, p i is an augmenting path associated with flow f i 1 for 1 i k. Thus, starting from the null flow f 0, by adding augmenting path p i for i = 1, 2,..., k, we can eventually get a max flow f k in G. Note that for any max flow in G, we may not be able to write it as the sum of a sequence of augmenting paths, since a zero flow is not necessarily a null flow. For example, V = {s, x, y, z, t} and c(s, x) = c(y, t) = 1, c(x, y) = c(y, z) = c(z, x) = 2. Thus the flow f with f(s, x) = f(y, t) = f(y, z) = f(z, x) = 1, f(x, y) = 2 is a max flow in G. However, it can not be found by a sequence of augmenting paths. The one that can be found by the above procedures is f with f(s, x) = f(x, y) = f(y, t) = 1. 4

14.5 Edge connectivity In homework 13.2 (s, t-connectivity problem), by assigning a unit capacity to the graph, we knew that there are exactly k edge-disjoint paths from s to t, where k is the value of any max flow from s to t in G. Thus if we want to disconnect s and t in G, we have to remove at least k edges. On the other hand, we can find a min cut A, B for source s and sink t. Removing all the edges between A and B disconnects s and t. However, from the Max Flow-Min Cut Theorem, the number of edges between A and B, which is also the value of this min cut, is k. Therefore, to disconnect s and t need and only need removing k edges from G. To disconnect G is equivalent to disconnect a fixed vertex s and some other vertex t in G. Thus, we can select and fix a vertex s. Then apply the max flow algorithm to G with unit capacities and pair (s, t), for every vertex t V {s}. For each pair (s, t), we get a max flow with value k(t), which is the minimum number of edges needed to be removed in order to disconnect s and t. Calculate K = min k(t). t V {s} Then it is the edge connectivity of G, i.e., the minimum number of edges that must be removed to disconnect G. The max flow algorithm runs V 1 times. The capacitated G has 2 E edges and V vertices, since two directed edges with unit capacities are added for one undirected edge in E. Thus we meet the requirements in the problem. 5

14.6 Updating max flow Lemma: Let G = (V, E, c) and G + = (V, E, c + ) be two capacitated graphs. c + = c except for edge (u, v), c + (u, v) = c(u, v) + 1. f max is a max flow in G and f + max is a max flow in G +. Then f max f + max f max + 1. Thus for integral capacitated graphs, f + max = f max or f + max = f max + 1. Proof: Since G and G + share the same V and E, a min cut A, B in G is also a cut in G +. By the construction of c +, we have c + (A, B) c(a, B) + 1. Thus f max + c + (A, B) c(a, B)+1 = f max +1. Since any flow in G is also a flow in G +, we also have f max f max. + Therefore f max f max + f max + 1. For integral capacities, this equals f max + = f max or f max + = f max + 1. (a) Let f max be the given max flow in G, and G + be the capacitated graph with the capacity of edge (u, v) increased by 1. By the Lemma, the value of a max flow in G + is either f max or f max + 1. Thus by adding at most 1 augmenting path to f max, we can get a max flow in G +. The algorithm is 1. Calculate the residual graph G + f max associated with f max in G + with time O(m). 2. Find an augmenting path in G + f max by BFS with time O(m). 3. If no augmenting path is found, f max is a max flow in G +. Otherwise adding the augmenting path to f max (with time O(n)) and the new flow is a max flow in G +. Thus, the total time is O(m + n). (b) Let f max be the given max flow in G, and G be the capacitated graph with the capacity of edge (u, v) decreased by 1. G can be taken as (G ) +. By the Lemma, the value of a max flow in G is either f max or f max 1. As in the proof of the Lemma, we can first find a flow f in G with value f max 1 by decreasing f max along some path. Thus by adding at most 1 augmenting path to f, we can get a max flow in G. The algorithm is 1. Find a path p in f max (that is, an edge (u, v ) will be explored iff f max (u, v ) > 0) from s to t containing edge (u, v) by BFS, with time O(m). 2. Construct flow f in G by decreasing f max by 1 along p. The time is O(n). 3. Calculate the residual graph G f associated with f in G with time O(m). 4. Find an augmenting path in G f by BFS with time O(m). 5. If no augmenting path is found, f is a max flow in G. Otherwise adding the augmenting path to f (with time O(n)) and the new flow is a max flow in G. Thus, the total time is O(m + n). 6