384 CHAPTER 11. NP-COMPLETENESS 11-8. [7] Design and implement a backtracking algorithm to test whether a set of clause sets is satisfiable. What criteria can you use to prune this search? 11-9. [8] Implement the vertex cover to satisfiability reduction, and run the resulting clauses through a satisfiability solver code. Does this seem like a practical way to compute things? Basic Reductions 11-10. [4] An instance of the set cover problem consists of a set X of n elements, a family F of subsets of X, and an integer k. The question is, does there exist k subsets from F whose union is X? For example, if X = {1, 2, 3, 4} and F = {{1, 2}, {2, 3}, {4}, {2, 4}}, there does not exist a solution for k = 2, but there does for k = 3 (for example, {1, 2}, {2, 3}, {4}). Prove that set cover is NP-hard with a reduction from vertex cover. 11-11. [4] The baseball card collector problem is as follows. Given packets P1 , . . . , Pm , each of which contains a subset of this year’s baseball cards, is it possible to collect all the year’s cards by buying ≤ k packets? For example, if the players are {Aaron, M ays, Ruth, Skiena} and the packets are {{Aaron, M ays}, {M ays, Ruth}, {Skiena}, {M ays, Skiena}}, there does not exist a solution for k = 2, but there does for k = 3, such as {Aaron, M ays}, {M ays, Ruth}, {Skiena} Prove that the baseball card collector problem is NP-hard using a reduction from vertex cover. 11-12. [4] The low-degree spanning tree problem is as follows. Given a graph G and an integer k, does G contain a spanning tree such that all vertices in the tree have degree at most k (obviously, only tree edges count towards the degree)? For example, in the following graph, there is no spanning tree such that all vertices have a degree at most three. (a) Prove that the low-degree spanning tree problem is NP-hard with a reduction from Hamiltonian path. (b) Now consider the high-degree spanning tree problem, which is as follows. Given a graph G and an integer k, does G contain a spanning tree whose highest degree vertex is at least k? In the previous example, there exists a spanning tree with a highest degree of 7. Give an efficient algorithm to solve the high-degree spanning tree problem, and an analysis of its time complexity. 11.10. EXERCISES 385 11-13. [5] In the minimum element set cover problem, we seek a set cover S ⊆ C of a universal set U = {1, . . . , n} such that sum of the sizes of the subsets in S is at most k. (a) Show that C = {{1, 2, 3}, {1, 3, 4}, {2, 3, 4}, {3, 4, 5}} has a cover of size 6, but none of size 5 because of a repeated element. (b) Prove that this problem is NP-hard. (Hint: set cover remains hard if all subsets are of the same size.) 11-14. [3] The half-Hamiltonian cycle problem is, given a graph G with n vertices, determine whether G has a simple cycle of length exactly #n/2$, where the floor function rounds its input down to the nearest integer. Prove that this problem is NP-hard. 11-15. [5] The 3-phase power balance problem asks for a way! to partition ! a set!of n positive integers into three sets A, B, or C such that i ai = i bi = i ci . Prove that this problem is NP-hard using a reduction from integer partition or subset sum (see Section 10.5 (page 329)). 11-16. [4] Show that the following problem is NP-hard: Problem: Dense Subgraph Input: A graph G, and integers k and y. Output: Does G contain a subgraph of exactly k vertices and at least y edges? 11-17. [4] Show that the following problem is NP-hard: Problem: Clique, No-clique Input: An undirected graph G = (V, E) and an integer k. Output: Does G contain both a clique of size k and an independent set of size k? 11-18. [5] An Eulerian cycle is a tour that visits every edge in a graph exactly once. An Eulerian subgraph is a subset of the edges and vertices of a graph that has an Eulerian cycle. Prove that the problem of finding the number of edges in the largest Eulerian subgraph of a graph is NP-hard. (Hint: the Hamiltonian circuit problem is NP-hard even if each vertex in the graph is incident upon exactly three edges.) 11-19. [5] Show that the following problem is NP-hard: Problem: Maximum Common Subgraph Input: Two graphs G1 = (V1 , E1 ) and G2 = (V2 , E2 ), and a budget b. Output: Two sets of nodes S1 ⊆ V1 and S2 ⊆ V2 whose deletion leaves at least b nodes in each graph, and makes the two graphs identical. 11-20. [5] A strongly independent set is a subset of vertices S in a graph G such that for any two vertices in S, there is no path of length two in G. Prove that strongly independent set is NP-hard. 11-21. [5] A kite is a graph on an even number of vertices, say 2n, in which n of the vertices form a clique and the remaining n vertices are connected in a tail that consists of a path joined to one of the vertices of the clique. Given a graph and a goal g, the max kite problem asks for a subgraph that is a kite and contains 2g nodes. Prove that max kite is NP-hard.