Tutorial for Algorithm s Theory Problem Set 5. January 17, 2013

Similar documents
Preflow-Push Algorithm

CS261: Problem Set #1

Chapter 5 Graph Algorithms Algorithm Theory WS 2012/13 Fabian Kuhn

Maximum Flow Algorithms

Today. Maximum flow. Maximum flow. Problem

Network Design and Optimization course

Lecture 11: Maximum flow and minimum cut

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

Maximum Flow. Flow Networks. Flow Networks Ford-Fulkerson Method Edmonds-Karp Algorithm Push-Relabel Algorithms. Example Flow Network

Lecture 4. 1 Overview. 2 Preflows. COMPSCI 532: Design and Analysis of Algorithms September 4, 2015

Minimum Cost Edge Disjoint Paths

Jessica Su (some parts copied from CLRS / last quarter s notes)

Homework 3 Solutions

CSE 417 Network Flows (pt 3) Modeling with Min Cuts

COT 6936: Topics in Algorithms! Giri Narasimhan. ECS 254A / EC 2443; Phone: x3748

1 Introduction. 2 The Generic Push-Relabel Algorithm. Improvements on the Push-Relabel Method: Excess Scaling. 2.1 Definitions CMSC 29700

and 6.855J March 6, Maximum Flows 2

CSE 417 Network Flows (pt 4) Min Cost Flows

CS261: A Second Course in Algorithms Lecture #3: The Push-Relabel Algorithm for Maximum Flow

Lecture 3: Graphs and flows

Maximum flows & Maximum Matchings

Problem Set 7 Solutions

Network Flow. November 23, CMPE 250 Graphs- Network Flow November 23, / 31

Final Exam Spring 2003

Graph Algorithms Matching

GRAPH DECOMPOSITION BASED ON DEGREE CONSTRAINTS. March 3, 2016

Network Flow. The network flow problem is as follows:

Cuts, Connectivity, and Flow

Solving problems on graph algorithms

CME 305: Discrete Mathematics and Algorithms Instructor: Reza Zadeh HW#3 Due at the beginning of class Thursday 02/26/15

Matching Algorithms. Proof. If a bipartite graph has a perfect matching, then it is easy to see that the right hand side is a necessary condition.

Parametric Maximum Flow Problem: Techniques and Algorithms. Deepika Sareen, Dr Deepak Garg. Thapar University, Patiala

Solution for Homework set 3

Solutions for the Exam 6 January 2014

Discrete Wiskunde II. Lecture 6: Planar Graphs

Copyright 2007 Pearson Addison-Wesley. All rights reserved. A. Levitin Introduction to the Design & Analysis of Algorithms, 2 nd ed., Ch.

Definition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1

Module 7. Independent sets, coverings. and matchings. Contents

Final Exam. Jonathan Turner 5/12/2010. CS 542 Advanced Data Structures and Algorithms

Lecture 3: Totally Unimodularity and Network Flows

Network Flows. 1. Flows deal with network models where edges have capacity constraints. 2. Shortest paths deal with edge costs.

Lecture and notes by: Sarah Fletcher and Michael Xu November 3rd, Multicommodity Flow

Datenstrukturen & Algorithmen Solution of Sheet 11 FS 14

Bipartite Matching & the Hungarian Method

1. Suppose you are given a magic black box that somehow answers the following decision problem in polynomial time:

LECTURES 3 and 4: Flows and Matchings

Network Flow and Matching

CS/COE 1501 cs.pitt.edu/~bill/1501/ Network Flow

by conservation of flow, hence the cancelation. Similarly, we have

Ma/CS 6b Class 2: Matchings

Graph Algorithms Maximum Flow Applications

1 Matchings in Graphs

Outline: Finish uncapacitated simplex method Negative cost cycle algorithm The max-flow problem Max-flow min-cut theorem

Graphs and Algorithms 2015

Source. Sink. Chapter 10: Iterative Programming Maximum Flow Problem. CmSc250 Intro to Algorithms

Network flows and Menger s theorem

Graphs and Algorithms 2016

Graphs. Edges may be directed (from u to v) or undirected. Undirected edge eqvt to pair of directed edges

COMP 251 Winter 2017 Online quizzes with answers

Assignment 4 Solutions of graph problems

Reducing Directed Max Flow to Undirected Max Flow and Bipartite Matching

CS473-Algorithms I. Lecture 13-A. Graphs. Cevdet Aykanat - Bilkent University Computer Engineering Department

arxiv: v2 [cs.cc] 29 Mar 2010

Paths, Flowers and Vertex Cover

8 NP-complete problem Hard problems: demo

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

1. To reduce the probability of having any collisions to < 0.5 when hashing n keys, the table should have at least this number of elements.

Notes for Lecture 20

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

A Lock-free Multi-threaded Algorithm for the Maximum Flow Problem

Matching and Planarity

Tutorial 4: Flow Artificial Intelligence

Test 1 Last 4 Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. 2 points each t 1

An Optimal Algorithm for the Euclidean Bottleneck Full Steiner Tree Problem

CME 305: Discrete Mathematics and Algorithms Instructor: Reza Zadeh HW#3 Due at the beginning of class Thursday 03/02/17

Lecture 3: Art Gallery Problems and Polygon Triangulation

CSC 8301 Design & Analysis of Algorithms: Linear Programming

Introduction to Graph Theory

Generalized Pebbling Number

Treewidth and graph minors

11.1. Definitions. 11. Domination in Graphs

2. Lecture notes on non-bipartite matching

1 The Traveling Salesperson Problem (TSP)

Steiner Trees and Forests

16.1 Maximum Flow Definitions

Discrete Mathematics, Spring 2004 Homework 8 Sample Solutions

CS261: Problem Set #2

AMS /672: Graph Theory Homework Problems - Week V. Problems to be handed in on Wednesday, March 2: 6, 8, 9, 11, 12.

Modules. 6 Hamilton Graphs (4-8 lectures) Introduction Necessary conditions and sufficient conditions Exercises...

PERFECT MATCHING THE CENTRALIZED DEPLOYMENT MOBILE SENSORS THE PROBLEM SECOND PART: WIRELESS NETWORKS 2.B. SENSOR NETWORKS OF MOBILE SENSORS

Theorem 3.1 (Berge) A matching M in G is maximum if and only if there is no M- augmenting path.

1 Matching in Non-Bipartite Graphs

CSE 417 Network Flows (pt 2) Modeling with Max Flow

Matching Theory. Figure 1: Is this graph bipartite?

Algorithm Circle Extra Lecture: Solving the Assignment Problem with Network Flow

The Encoding Complexity of Network Coding

Algorithm and Complexity of Disjointed Connected Dominating Set Problem on Trees

UML CS Algorithms Qualifying Exam Fall, 2003 ALGORITHMS QUALIFYING EXAM

Math 485, Graph Theory: Homework #3

Important separators and parameterized algorithms

Transcription:

Tutorial for Algorithm s Theory Problem Set 5 January 17, 2013

Exercise 1: Maximum Flow Algorithms Consider the following flow network: a) Solve the maximum flow problem on the above network by using the Ford Fulkerson algorithm b) Solve the maximum flow problem on the above network by using the preflow-push algorithm. Use the variant of the algorithm that always applies a push or relabel operation to a maximum height node with positive excess. c) Give a minimum capacity s t cut of the given network. () 2

Solution 1a: Ford Fulkerson algorithm Improve flow using an augmenting path as long as possible: 1: Initially, f (e) = 0 for all edges e E, G f = G 2: while there is an augmenting s-t path P in G f do 3: Let P be an augmenting path in G f 4: f := augment(f, P) 5: update f to f 6: update the residual graph G f 7: end () 3

Solution 1a: Ford Fulkerson algorithm Step 1. Flow graph (on the left) and residual graph (on the right) () 4

Solution 1a: Ford Fulkerson algorithm Step 2. Flow graph (on the left) and residual graph (on the right) () 4

Solution 1a: Ford Fulkerson algorithm Step 3. Flow graph (on the left) and residual graph (on the right) () 4

Solution 1a: Ford Fulkerson algorithm Step 4. Flow graph (on the left) and residual graph (on the right) () 4

Solution 1a: Ford Fulkerson algorithm Step 5. Flow graph (on the left) and residual graph (on the right) () 4

Solution 1a: Ford Fulkerson algorithm Step 6. Flow graph (on the left) and residual graph (on the right) () 4

Solution 1a: Ford Fulkerson algorithm Finally, the algorithm terminates because there are no more augmenting paths. Below is given the maximum flow we get from applying the Ford-Fulkerson algorithm on the given graph. () 5

Solution 1b: Preflow-push algorithm Initialization: height(s) = 0 and h(v) = 0 for all other nodes Saturate all edges that go out of source node s Set the flow to 0 for all other nodes. Note that, given a node, along with its label (e.g., s, a,...), the first number denotes the height and the second number the excess value () 6

Solution 1b: Preflow-push algorithm Choose node with maximum height. E.g., select node a arbitrarily. Push operation is not possible, since h(a) = h(v) for all v s Therefore, relabel a, i.e., h(a) := h(a) + 1 = 1 Consider node a, since h(a) = 1. Push operation is possible, since e = (a, t) has positive residual capacity Flow at this edge is increased by min{e f (a), c e f (e)} = {10, 5 0} = 5 () 7

Solution 1b: Preflow-push algorithm Consider again node a. Push is possible, since h(a) > h(c) and the edge (a, c) has a positive residual capacity. Increase flow at edge (a, c) by min{e f (a), c e f (e)} = {5, 3 0} = 3 () 8

Solution 1b: Preflow-push algorithm Consider again node a (all other nodes have height of 0 and the excess value of a is still larger than 0). Push is not possible, since there are no more forward edges with a positive residual capacity. Hence, relabel a, i.e., h(a) := h(a) + 1 = 2 Note the above steps will be repeated again and again until h(a) = 7 Consider again node a (for the same reasons as above). Push is possible, because s is a neighbor of a such that h(a) > h(s) and the residual capacity of edge e = (a, s) is positive. Since we are now dealing with a backward edge, we must decrease the flow at this edge by min{e f (a), f (e)} = min{2, 10} = 2 Hence, the flow at edge (s, a) equals 8. () 9

Solution 1b: Preflow-push algorithm () 9

Solution 1b: Preflow-push algorithm Note that all remaining nodes with positive excess values have a height of 0. So, we arbitrarily pick node b. Push is not possible, since h(b) = h(v) for all v s Therefore, relabel b, i.e., h(b) := h(b) + 1 = 1 Now the algorithm will choose node b Push is possible, because h(b) > h(d) and edge e = (b, d) has positive residual capacity. Therefore, increase the flow at e by min{e f (b), c e f (e)} = min{8, 3 0} = 3 The excess value of node b will now become 5. Choose node b again Push is possible for similar reasons as above Increase flow at e = (b, c) by min{e f (b), c e f (e)} = min{5, 10} = 5 The excess value of node b will now become 0. () 10

Solution 1b: Preflow-push algorithm () 10

Solution 1b: Preflow-push algorithm Between c, d choose arbitrarily node d. Push is not possible, since h(d) = h(v) for all v s Therefore, relabel d, i.e., h(d) := h(d) + 1 = 1 Now Push is possible, because h(d) > h(t) and edge e = (d, t) has positive residual capacity. Increase the flow at e by min{e f (d), c e f (e)} = min{5, 10} = 5 The excess value of node d will now become 0. () 11

Solution 1b: Preflow-push algorithm Select node c, as it is the only node with positive excess value. Push is not possible, since h(c) = h(v) for all v s Therefore, relabel c, i.e., h(c) := h(c) + 1 = 1 Now Push is possible, because h(c) > h(t) and edge e = (c, t) has positive residual capacity. Increase the flow at e by min{e f (c), c e f (e)} = min{8, 8} = 8 The excess value of node c will now become 0. () 12

Solution 1b: Preflow-push algorithm Finally, the algorithm terminates because there are no nodes which have a positive excess value. The preflow turned into a maximum flow, the result of which is shown below () 13

Solution 1c: Minimum capacity s t cut An s t cut is a partition (A, B) of the vertex set such that s A and t B. Note that Ford-Fulkerson also gives a min-cut algorithm To get such minimum capacity cut we use the following steps Add source nodes to A. Hence A = {s} Extend A by adding a to it, because there exists the edge (s, a) which has a positive residual capacity. Hence A = {s, a} Since now A has only outgoing edges with c e f (e) = 0, it cannot be extended further. Solution found!! Finally, A = {s, a} and B = {b, c, d, t} Note that the capacity of a s t cut (A, B) is defined as follows c(a, B) = c e = 8 + 5 + 5 + 3 = 21 e out of A () 14

Exercise 2: Forward-Only Paths Assume a simplified variant of the Ford-Fulkerson algorithm, such that when computing augmenting paths, it only considers forward edges of the residual graph and it does not consider backward edges at all. The claim is that this algorithm always computes a solution that is within a constant factor of the optimal one. That is, there is an absolute constant b > 1 such that the forward-edge-only algorithm computes a flow of value at least 1/b times the value of an optimal flow. If this claim is true, prove it. Otherwise show that the ratio of the maximum flow value and the flow computed by the forward-edge-only algorithm can be arbitrarily large. Assume that the forward-edge-only implementation always takes an arbitrary (possibly worst-case) augmenting path of only forward edges as long as such an augmenting path exists. You can also assume that all edge capacities are positive integers. () 15

Exercise 2: Forward-Only Paths Such simplified variant of the Ford-Fulkerson algorithm does not always compute a solution that is within a constant factor of the optimal one. Consider a construction like the following Every node has an edge connecting it to every node either horizontally or vertically strictly adjacent to it (not diagonally). Also, it has a source node s connecting it to nodes (i, 1) and a sink node connecting to nodes (i, n) for all i 1... n. All edge capacities are 1 and the maximum flow is n. () 16

Exercise 2: Forward-Only Paths Assume if our first choice is a path like the one shown in red. Now, we cannot choose any other augmenting path of forward-edges with positive residual capacity. Hence, the resulting s t flow has a value of 1. It is clear that the ratio n 1 is not bounded by any absolute constant b such that b > 1. () 17

Exercise 4 : Bipartite Matching We consider the Bipartite Matching Problem on a bipartite graph G = (V, E). As usual, we assume that V is partitioned into sets X and Y, and each edge has one end in X and the other in Y. If M is a matching in G, we say that a node y Y is covered by M if y is an end of one of the edges in M. a) Consider the following problem. We are given G and a matching M in G. For a given number k, we want to decide if there is a matching M in G so that i) M has k more edges than M does, and ii) every node y Y that is covered by M is also covered by M. Give a polynomial-time algorithm that takes an instance of Coverage Expansion and either returns a solution M or reports (correctly) that there is no solution. b) Give an example of an instance of Coverage Expansion, specified by G, M, and k, so that the following situation happens. The instance has a solution; but in any solution M, the edges of M do not form a subset of the edges of M. () 18

Solution 4a : Coverage Expansion Idea: Transform Coverage Expansion into a Maximum-Flow Given a bipartite graph G = (V 1 V 2, E), matching M and an integer k 1 Add source and sink nodes, s, t O(1) 2 Add directed edges from s to each node in V 1 O( V 1 ) 3 Add directed edges from each node in V 2 to t O( V 2 ) 4 Add edges from V 1 to V 2 O( E ) 5 Set the capacity of each edge in matching M to 0 O( M ) Edges in M cannot be taken in augmenting paths 6 Set the capacity of all the other edges to 1 O( E M ) Add capacities to the remaining edges to conclude the transformation Therefore, the overall running time of this procedure is O( E ) () 19

Solution 4a : Coverage Expansion Algorithm: Coverage-Expansion-Solver(G, M, k) Input: bipartite graph G, matching M, and integer k Output: a matching M if possible, otherwise false 1: if k < 0 then 2: return false O(1) 3: if k == 0 then 4: return M 5: G = transform G into a network flow G as specified above O( E ) 6: f = Ford-Fulkerson(G ) O( E n) 7: if f M + k then 8: M = pick k disjoint edges, where each edge has the form e = (v, u), s.t., v V 1, u V 2 O( E ) 9: M := M M O( M + k) = O( E + k) = O( E ) 10: return M 11: else 12: return false Therefore, the overall running time of this algorithm is O( E n) () 20

Solution 4a : Coverage Expansion G = transform G into a network flow G as specified above f = Ford-Fulkerson(G ) if f M + k then M = pick k disjoint edges, where each edge has the form e = (v, u), s.t., v V 1, u V 2 M := M M return M We must show that f M + k iff there are at least k disjoint edges between V 1 and V 2. which are also disjoint to the edges in M. ( ) Assume f M + k. Since all edges have capacity 1 (except those in M), then there must be at least f edge-disjoint paths from s to t. This implies that there are at least k disjoint edges between V 1 and V 2 ( ) Assume there are k disjoint edges between V 1 and V 2, which are also disjoint to the edges in M. Now, we can take the edges from M and get a flow of M + k which satisfies the formula f M + k () 21

Solution 4b : Coverage Expansion Example The instance has a solution; but in any solution M, the edges of M do not form a subset of the edges of M. Let the above be a bipartite graph whose nodes are partitioned in A = {v 1, v 2 } and B = {v 2, v 4 } Let M = {(v 3, v 2 )} be the matching indicated by the red line Let k = 1 and let this be an instance of the coverage expansion problem M = 1 = M = M + k = 2 Let M = {(v 1, v 2 ), (v 3, v 4 )} Note that M has more edges than M and every node covered in M is also covered in M Moreover, the edges in M are not a subset of the edges in M () 22