Escape problem An n n grid is an undirected graph consisting of n rows and n columns of vertices, as shown in Figure 26.11. We denote the vertex in the ith row and the j th column by .i; j /. All vertices in a grid have exactly four neighbors, except for the boundary vertices, which are the points .i; j / for which i D 1, i D n, j D 1, or j D n. Given m n2 starting points .x1; y1/; .x2; y2/; : : : ; .xm; ym/ in the grid, the escape problem is to determine whether or not there are m vertex-disjoint paths from the starting points to any m different points on the boundary. For example, the grid in Figure 26.11(a) has an escape, but the grid in Figure 26.11(b) does not. a. Consider a flow network in which vertices, as well as edges, have capacities. That is, the total positive flow entering any given vertex is subject to a capacity constraint. Show that determining the maximum flow in a network with edge and vertex capacities can be reduced to an ordinary maximum-flow problem on a flow network of comparable size. (a) (b) Figure 26.11 Grids for the escape problem. Starting points are black, and other grid vertices are white. (a) A grid with an escape, shown by shaded paths. (b) A grid with no escape. b. Describe an efficient algorithm to solve the escape problem, and analyze its running time.
Read moreTable of Contents
Textbook Solutions for Introduction to Algorithms
Question
Algorithmic consulting Professor Gore wants to open up an algorithmic consulting company. He has identified n important subareas of algorithms (roughly corresponding to different portions of this textbook), which he represents by the set A D fA1; A2;:::;Ang. In each subarea Ak, he can hire an expert in that area for ck dollars. The consulting company has lined up a set J D fJ1; J2;:::;Jmg of potential jobs. In order to perform job Ji, the company needs to have hired experts in a subset Ri A of subareas. Each expert can work on multiple jobs simultaneously. If the company chooses to accept job Ji , it must have hired experts in all subareas in Ri , and it will take in revenue of pi dollars. Professor Gores job is to determine which subareas to hire experts in and which jobs to accept in order to maximize the net revenue, which is the total income from jobs accepted minus the total cost of employing the experts. Consider the following flow network G. It contains a source vertex s, vertices A1; A2;:::;An, vertices J1; J2;:::;Jm, and a sink vertex t. For k D 1; 2 : : : ; n, the flow network contains an edge .s; Ak/ with capacity c.s; Ak/ D ck, and for i D 1; 2; : : : ; m, the flow network contains an edge .Ji;t/ with capacity c.Ji;t/ D pi. For k D 1; 2; : : : ; n and i D 1; 2; : : : ; m, if Ak 2 Ri, then G contains an edge .Ak; Ji/ with capacity c.Ak; Ji/ D 1. a. Show that if Ji 2 T for a finite-capacity cut .S; T / of G, then Ak 2 T for each Ak 2 Ri. b. Show how to determine the maximum net revenue from the capacity of a minimum cut of G and the given pi values. c. Give an efficient algorithm to determine which jobs to accept and which experts to hire. Analyze the running time of your algorithm in terms of m, n, and r D Pm iD1 jRij.
Solution
The first step in solving 26 problem number 3 trying to solve the problem we have to refer to the textbook question: Algorithmic consulting Professor Gore wants to open up an algorithmic consulting company. He has identified n important subareas of algorithms (roughly corresponding to different portions of this textbook), which he represents by the set A D fA1; A2;:::;Ang. In each subarea Ak, he can hire an expert in that area for ck dollars. The consulting company has lined up a set J D fJ1; J2;:::;Jmg of potential jobs. In order to perform job Ji, the company needs to have hired experts in a subset Ri A of subareas. Each expert can work on multiple jobs simultaneously. If the company chooses to accept job Ji , it must have hired experts in all subareas in Ri , and it will take in revenue of pi dollars. Professor Gores job is to determine which subareas to hire experts in and which jobs to accept in order to maximize the net revenue, which is the total income from jobs accepted minus the total cost of employing the experts. Consider the following flow network G. It contains a source vertex s, vertices A1; A2;:::;An, vertices J1; J2;:::;Jm, and a sink vertex t. For k D 1; 2 : : : ; n, the flow network contains an edge .s; Ak/ with capacity c.s; Ak/ D ck, and for i D 1; 2; : : : ; m, the flow network contains an edge .Ji;t/ with capacity c.Ji;t/ D pi. For k D 1; 2; : : : ; n and i D 1; 2; : : : ; m, if Ak 2 Ri, then G contains an edge .Ak; Ji/ with capacity c.Ak; Ji/ D 1. a. Show that if Ji 2 T for a finite-capacity cut .S; T / of G, then Ak 2 T for each Ak 2 Ri. b. Show how to determine the maximum net revenue from the capacity of a minimum cut of G and the given pi values. c. Give an efficient algorithm to determine which jobs to accept and which experts to hire. Analyze the running time of your algorithm in terms of m, n, and r D Pm iD1 jRij.
From the textbook chapter Maximum Flow you will find a few key concepts needed to solve this.
Visible to paid subscribers only
Step 3 of 7)Visible to paid subscribers only
full solution