NP-Completeness Problems

NP-Completeness Problems
Problem 1- Show that the GRAPH-COLORABILITY problem described as follows is
NP-COMPLETE. Consider an undirected graph G = (V,E). A k-coloring of the graph is an
assignment of k distinct colors to the vertices of the graph in such a way that no two vertices
assigned the same color are adjacent (i.e. have an edge between them). The GRAPHCOLORABILITY problem is to find a coloring involving the fewest colors. Stated as a decision
problem, an instance of the GRAPH-COLORABILITY problem consists of an undirected graph
G=(V,E) and an integer k. The instance is a “YES” instance if G has a k-coloring.
[HINT: Use reduction from 3-CNF-SAT.
Suppose you are given a formula with m clauses C1,C2,...,Cm and n variables x1,x2,...,xn.
Construct a graph with 3n + m vertices corresponding to v1, v2, . . . vn, x1, x2, . . . xn, !x1, !x2, .
. . !xn, and c1, c2, . . . , cm, where !xi stands for the complement of xi. The vertices v1,...,vn are
vertices we add to help us with the conversion. Their purpose will be clear below.
The graph has exactly the following edges:
(a) (vi, vj) for all i != j.
(b) (vi, xj) and (vi, !xj) for all i != j.
(c) (xi, !xi) for all i.
(d) (xi, cj) if xi is not a term in clause Cj , and (!xi, cj) if !xi is not a term in clause Cj .
Prove that for n > 4, the constructed graph is n+ 1 colorable if and only if the 3-CNF
from which it is constructed is satisfiable. (Hint: The vi vertices form a complete graph
or clique of n vertices and so each must be assigned a distinct color. Think about what
to do with your one extra color.)
Problem 2. Exercise 34.5-2 in your textbook.
Problem 3. Problem 34-4 in your textbook.
Problem 4. The SUBGRAPH-ISOMORPHISM problem is defined as follows:
You are given graphs G1 = (V1, E1) and G2 = (V2, E2). G1 is isomorphic to a subgraph
of G2 if and only if there is a one-to-one mapping function f:V1 V2 such that
(u,v) is an edge in E1 if and only if (f(u),f(v)) is an edge in E2
Intuitively, you are trying to find a subgraph of G2 that looks exactly like G1.
Prove by reduction from CLIQUE or HAMILTONIAN-CYCLE that SUBGRAPH
ISOMORPHISM is NP-complete.
Problem 5. Show that the decision version of the 0/1 knapsack problem is in NP-hard.
Describe what you need to do to show this and then do it. To solve this, you should make
use of the following info about another problem.
The subset sum problem is this: Given a set S of n integers and an integer k, is there a
subset of integers in S that sum to k? For example, if S = { 1, 2, 5, 8 } then the result
would be "yes" for k=8, but it would be "no" for k=12. Subset-Sum is known to be NPComplete (see your book), and you can use this information to answer this question.
The decision version of the 0/1 knapsack problem is stated below.
Inputs: A set S of n items, where each item has a value vi and volume wi. Also, you are
given a knapsack volume capacity W and a target-value k.
Required solution: choose a subset O of S such that the total volume of the items chosen
does not exceed W and the sum of the values of items in O is no less than k.
Problem 6 You are given a box and a collection of N cards as indicated in the following
figures. Each card is gray on one side and white on the other side. Because of the shapes of the
cards, which exactly match the shape of the hole in the box, each card will fit in the box in only
two possible ways (gray-side-up or white-side-up). Each card contains 2R circles lined up in two
columns and R rows, each of which may be punched out (so it is a hole) or not. Your puzzle is to
see if you can place all the cards in the box (Each one either gray-side-up or white-side-up) so as
to completely cover the bottom of the box, i.e. each of the 2R circle positions is covered by at
least one card that has no hole punched out there.
For example, in the cards for Puzzle 1 (left example below), with 2 cards each with 2 rows, it is
not possible to put them in the box to cover each circle, but with Puzzle 2 (right example below),
with 2 cards each with 3 rows, it is possible. (Punched-out-circles are shown in black).
Your job is to show that solving this puzzle (deciding if the cards can be put in the box to cover
each circle position) is NP-complete.
Hint: Show that 3-SAT can be reduced to an instance of solving this puzzle. Recall that 3-SAT
is the problem of deciding whether a Boolean expression like the following can be satisfied
(made True) by assigning True and False values to the variables xi:
(x1  x4  x9)  (x2  x1  x3)  …..  (x5  x6  x7)
Try representing each Boolean variable in the 3-SAT problem by a card, and each clause (such as
(x1  x4  x9)) by a row in each card.