CS6382 Theory of Computation Spring 2014 Homework #2 Due on Sunday, 3/2/2014 Instructor: Ding Du Emrah Cem(exc103320) 1 Emrah Cem CS6382 (Ding Du): Homework #2 Contents Problem 1 3 Problem 2 4 Problem 3 5 Problem 4 6 Problem 5 7 Page 2 of 7 Emrah Cem CS6382 (Ding Du): Homework #2 Problem 1 Given a directed graph, find the minimum subset of edges such that every directed cycle contatins at least one edge in the subset. This problem is also known as Feedback Arc Set(FAS) problem. The decision version of FAS, FAS-D, is as follows: Instance : A directed graph G = (V, E), and a positive integer k. Question : Is there a subset of edges with size at most k such that every directed cycle contains at least one edge in the subset. Now we construct a polynomial time reduction from VERTEX-COVER (VC) to FAS-D. Consider an instance 0 0 0 of a VC consisting of a graph G = (V, E) and a positive integer k. Construct a directed graph G = (V , E ) 0 as follows: For each vertex v ∈ G, create two vertices vin and vout in G . For each edge (u, v) ∈ G, create 0 0 directed edges (uout , vin ) and (vout , uin ) in G . Additionally, for each v ∈ G, create edges (vin , vout ) in G . Fi0 0 0 nally, k = k. The claim is that < G, k > is a Y ES instance of VC iff < G , k > is a Y ES instance of FAS-D. Proof 0 0 If < G, k > is a Y ES instance of VC, then < G , k > is a Y ES instance of FAS-D: Let S ⊆ V form a ver0 0 tex cover in G, and |S| ≤ k. Edges S = {(vin , vout )|v ∈ S} form a feedback arc set in G of size at most 0 0 0 k. |S| ≤ k and S includes an edge for each v in S; therefore S ≤ k = k 0 . If a cycle in G enters a vertex vin , the only way to leave it is via the edge (vin , vout ), i.e., (vin , vout ) is the only outgoing edge of vertex vin . Similarly, a cycle can only enter vout through the edge (vin , vout ), i.e., (vin , vout ) is the only incoming edge 0 of vertex vout . Hence, if a cycle C exists in G , it should use the edge of type ({x}out , {y}in ) where x, y ∈ V . 0 (it should use because G is a bipartite graph with two disjoint sets S = {xout |x ∈ V }, and T = {yin |y ∈ V } 0 ), it must also use the edges ({x}in , {x}out ) and ({y}in , {y}out ). Furthermore, ({x}out , {y}in ) ∈ E implies 0 that (x, y) ∈ E, which means either x or y is in S. Thus, ({x}in , {x}out ) or ({y}in , {y}out ) is in S ; hence 0 C ∩ S 6= ∅. 0 0 0 If < G , k > is a Y ES instance of FAS-D, then < G, k > is a Y ES instance of VC: Conversely, let S form 0 0 0 a feedback edge set in G . Then , if edges in S is removed from G , then there would not have any cycle left by definition. We can assume, wlog, that the only edges removed are of the form (vin , vout ) since if some other edge, say (uout , vin ) is removed, all cycles in which this edge participated would have included (vin , vout ) and this edge could have been removed instead. The claim is that the set of vertices in G for 0 which the corresponding edge (vin , vout ) is removed in G forms a vertex cover. If not, suppose some edge 0 (u, v) is not covered. Then, the cycle (uin , uout ), (uout , vin ), (vin , vout ), (vout , uin ) in G is unbroken by the removal of the edges, which is a contradiction. Thus, < G, k > must be a Y ES instance of VC. Page 3 of 7 Emrah Cem CS6382 (Ding Du): Homework #2 Problem 1 Problem 2 Given a directed graph, find the minimum subset of vertices such that every directed cycle contains at least one vertex in the subset. Note that undirected graphs are special cases of directed graphs. Undirected graphs are directed graphs where for each edge (vi , vj ), there exist an edge (vj , vi ). Hence, showing that undirected version of the problem is NP-hard suffices. This problem is also known as Feedback Vertex Set(FVS) problem. Decision version of FVS, FVS-D, is as follows: Instance: An undirected G = (V, E), and a positive integer k Question: Is there a subset of vertices with size at most k such that every cycle contains at least one vertex in the subset. Now we construct a polynomial time reduction from VERTEX-COVER (VC) to FVS-D. Consider an 0 0 0 instance of a VC consisting of a graph G = (V, E) and a positive integer k. Construct G = (V , E ) 0 0 as follows: For each vertex v ∈ G create a vertex v in G , and for each edge (u, v) ∈ E, create a 0 0 0 0 0 0 0 0 0 vertex uv in G . For each edge (u, v) ∈ E, create three edges in G : (u , v ), (v , uv ), and (uv , u ). Fi0 0 0 nally, k = k. The claim is that < G, k > is a Y ES instance of VC iff < G , k > is a Y ES instance of FVS-D. Proof 0 0 If < G, k > is a Y ES instance of VC, then < G , k > is a Y ES instance of FVS-D: Let C be the vertex 0 0 cover in G. If we remove each vertex v corresponding to the vertex v ∈ C from G then, there would 0 be no cycle left in G – note that this is another way of describing FVS-D problem : Is there a subset of ver0 0 0 0 0 0 tices of size at most k whose removal destroys all cycles. If there would be a cycle (v , uv ), (uv , u ), (u , v ) 0 left in G , none of u and v could be in C; otherwise, the cycle would have been broken. Therefore, edge (u, v) in G would not have been covered, which contradicts the assumption that C ∈ V C in G. (Alternative argument: If we remove all vertices that forms a vertex cover from G, remaining vertices forms an independent set in G. If we remove all vertices that forms feedback vertex set, there would not have any cycle among remaining vertices. Since independent set, set of vertices with no edges in between, is a special case of a set of vertices that does not form a cycle, VC is a special case of FVS-D. Hence, every vertex cover is a feedback vertex set.) 0 0 0 If < G , k > is a Y ES instance of FVS-D, then < G, k > is a Y ES instance of VC: Let C be the subset of 0 vertices that form feedback vertex set in G . We can assume without loss of generality that only vertices 0 0 0 in C are of type v . If not, there should exist some vertices of type uv and we can replace each of them 0 0 0 with either u or v because they are contained in every cycle that uv is contained; and possibly more. Let 0 0 C = {v|v ∈ C }. If C ∈ / V C in G, there should exist at least one edge that is not covered, call it (u, v), then 0 none of u and v are in C, that implies if we remove each vertex v corresponding to a vertex v in C from 0 0 0 0 0 0 0 0 G , the cycle (v , uv ), (uv , u ), (u , v ) is not destroyed, which contradicts the assumption that C ∈ F V S 0 in G . Page 4 of 7 Emrah Cem CS6382 (Ding Du): Homework #2 Problem 2 Problem 3 Given a graph G, determine whether G has a vertex cover C satisfying the following conditions: (a) The subgraph G|C induced by C has no isolated point. (b) Every vertex in C is adjacent to a vertex not in C. Decision version of the problem, call it DP, is as follows : Input: A graph G = (V, E), and a positive integer k Problem: Is there a vertex cover C where |C| ≤ k and (a) the subgraph G|C induced by C has no isolated point (b) every vertex in C is adjacent to a vertex not in C. Now we construct a polynomial time reduction from VERTEX-COVER to DP. Consider an instance of a 0 0 0 VERTEX-COVER consisting of a graph G0 = (V 0 , E 0 ), where V 0 = {v1 , v2 , . . . , v|V 0 | }, and a positive integer h. We will construct G and a positive integer k as follows: We construct a graph G from G0 by adding h+3 new vertices v0 , v1 , . . . , vh+2 and connecting v0 to v1 , v2 , . . . , vh+2 and all vertices in G0 . Finally k = h+1. Proof If G0 has a vertex cover C 0 of size at most h then G has a vertex cover C of size at most k satisfying conditions (a) and (b). Let C = C 0 ∪ {v0 } \ T , where T contains all vertices in C 0 whose all neighbors (other end of incident edges) are also in C 0 . Clearly C has size at most h + 1 = k since C 0 has size at most h and we add a single element to it and remove 0 or more elements from it. C is a vertex cover in G because C 0 covers all edges in G0 and v0 covers all the remaining edges. Secondly, v0 is connected to all vertices in G including the vertices in C, so subgraph G|C induced by C has no isolated point; hence condition (a) is satisfied. Since C does not contain a vertex whose all neighbors are also in C, each vertex in C should have at least one neighbor not in C;hence condition (b) is satisfied. If G has a vertex cover C of size at most k and that vertex cover satisfies conditions (a) and (b), then G0 has a vertex cover C 0 of size at most h. Assume C ,without loss of generality, contains v0 but does not contain any vertices from the set {v1 , v2 , . . . , vk }. If C does not contain v0 , then to cover edges incident to v0 vertex cover should contain at least h + 2 + |V |, which is larger than k. So, v0 should be in C, 0 since v0 covers all the edges that {v1 , v2 , . . . , vh + 2} covers, so we can remove all of them. C = C \ {v0 } is 0 a vertex cover of size at most h = k − 1 in G. |C | is clearly at most h = k − 1 since we remove one element 0 from C which has cardinality at most k. C is a vertex cover in G0 . If not, C can not be vertex cover because v0 does not already cover any edge in G0 , there should be at least one edge that is not covered in G0 . Then, C can not be a vertex cover in G, which is a contradiction. Page 5 of 7 Emrah Cem CS6382 (Ding Du): Homework #2 Problem 3 Problem 4 Given two collections C and D of subsets of X and positive integer d, find a subset A of at most d elements of X to minimize the total number of subsets in C not hit by A and subsets in D hit by A. Lets call the problem as HITTING. Decision version of the problem, HITTING-D, is as follows: Instance: A set X, two collections C and D of subsets of X, two positive integers d and k. Problem: Is there a subset A of at most d elements of X such that the total number of subsets in C not hit by A and subsets in D hit by A is at most k? Now we construct a polynomial time reduction from VERTEX-COVER to HITTING-D. Consider an instance of a VERTEX-COVER consisting of a graph G = (V, E) and a positive integer h. Let X = V, C = E, D = ∅, d = h, k = 0. The claim is that G has a vertex cover of size at most h iff there exists a subset A of at most d elements of X such that the total number of subsets in C not hit by A and subsets in D hit by A is 0. Proof : If G = (V, E) has a vertex cover S of size at most h, then there exists a subset A of at most d=h elements of X such that the total number of subsets in C not hit by A and subsets in D hit by A is at most k = 0. Let S ⊆ V be a vertex cover in G. A = S is the YES instance of HITTING-D. |A| = |S| ≤ h = d. A hits all subsets in C and hence number of subsets in C not hit by A is 0. If there were a subset {vi , vj } in C that is not hit by A, then the edge (vi , vj ) would not have been covered by S, but S is a vertex cover; hence, contradiction. Moreover, D = ∅; therefore, number of subsets in D hit by A is zero no matter what A contains. Thus, A is a subset of size at most h elements of X such that the total number of subsets in C hit by A and subsets in D hit by A is equal to 0. (That shows VERTEX-COVER is a special case of HITTING-D problem.) If there exists a subset A of at most d elements of X such that the total number of subsets in C not hit by A and subsets in D hit by A is k = 0, then G = (V, E) has a vertex cover of size at most h. We can assume without loss of generality that C contains subsets of size exactly 2. If subset size is 1, then add one element to that set from X. This subset is already hit by A, so adding one more element does not change that fact. If subset size is more than 2, then remove all elements from the set until the size reduces to 2 satisfying that the set is still hit by A. Keeping at least one element that is hit by A is enough. Assume there exist an edge (u, v) in G that is not covered, then {u, v} is not hit by A, which is a contradiction since all subsets are hit by A ( since the total number of subsets in C not hit by A and subsets in D hit by A is 0). Therefore, all edges are covered in G by A. Page 6 of 7 Emrah Cem CS6382 (Ding Du): Homework #2 Problem 4 Problem 5 Given a 2-connected graph G and a vertex subset A, find the minimum subset B of vertices such that A ∪ B induces a 2-connected subgraph. Lets call the problem as 2-Connected Subgraph Augmentation Problem(2-CSAP). Decision version of the problem, 2-CSAP-D, is as follows: Instance: A 2-connected graph G = (V, E), a subset of vertices A ⊆ V , and a positive integer k. Problem: Is there a subset of vertices B with size at most k such that A∪B induces a 2-connected subgraph? Now we construct a polynomial time reduction from SET-COVER(SC) to 2-CSAP-D. Consider an instance of an SC consisting of a universe U = {u1 , u2 , . . . , un }, a collection of subsets C = {S1 , S2 , . . . , Sm }, where Si = {ui1 , ui2 , . . . , ui|Si | } and a positive integer h. Construct G, A, and k as follows: For each element ui in U , create a vertex ui in G. Additionally, for each subset Si in C, create a vertex Si in G. Moreover, create two vertices s and t in G. Create an edge between s and each ui for i ∈ {1, 2, . . . , n} in G. Create an edge between t and each Si for i ∈ {1, 2, . . . , m} in G. Create an edge between Si ∈ G and vertices ui1 , ui2 , . . . , ui|Si | for i ∈ {1, 2, . . . , n}. A = {u0 , u1 , . . . , un } ∪ {s, t}. Finally, k = h. The claim is that C has a set cover of size at most h iff there exists a subset of vertices B ∈ G with size at most k such that A ∪ B induces a 2-connected subgraph. Proof : Let S = {Sj1 , Sj2 , . . . , Sjt } ⊆ C be a set cover of U , where t ≤ h. B = S is a subset of vertices of size at most k such that A ∪ B induces a 2-connected subgraph. B = S is the set of vertices with cardinality at most k, since k = h and cardinality of S is at most h. Assume A ∪ B is not 2-connected induced subgraph, removing s should isolate at least one vertex uj in G. Each ui has a single edge to s, if ui remains isolated when s is removed from the graph, it should be the only edge; hence uj is not covered by any subset in S, which contradicts that S is a set cover. If there exists a subset B of vertices of size at most k such that A ∪ B induces a 2-connected subgraph. then there should be a set cover S of size at most h. S = B is the set cover of size at most h. Size of B is at most k = h; hence size of S is at most h. If S is not a set cover, then there should exist a vertex in G with a single edge, which is to s. If s is removed from A ∪ B, uj would be isolated from the rest of the graph, which is a contradiction that A ∪ B is a 2-connected induced subgraph. Page 7 of 7