The subgraph-isomorphism problem takes two undirected graphs
$G_1$ and$G_2$ , and it asks whether$G_1$ is isomorphic to a subgraph of$G_2$ . Show that the subgraph-isomorphism problem is NP-complete.
Prove SIP
The certificate
$|V_1| = |V_2|$ $|E_1| = |E_2|$ - for each pair of nodes
$u_i, v_i \in V_1$ :$(u_{C_{u_i}}, v_{C_{v_i}}) \in E_2$ if$(u_i, v_i) \in E_1$ - for each pair of nodes
$u_i, v_i \in V_1$ :$(u_{C_{u_i}}, v_{C_{v_i}}) \notin E_2$ if$(u_i, v_i) \notin E_1$
It takes
Prove SIP
Construction:
Suppose we want to check whether
CLIQUE $\Rightarrow$ SIP:
The clique is a subgraph of
SIP $\Rightarrow$ CLIQUE:
A subgraph in
Given an integer
$m \times n$ matrix$A$ and an integer$m$ -vector$b$ , the 0-1 integer-programming problem asks whether there exists an integer$n$ -vector$x$ with elements in the set$\{0, 1\}$ such that$Ax \le b$ . Prove that 0-1 integer programming is NP-complete. (Hint: Reduce from 3-CNF-SAT.)
Prove 0-1-IP
The certificate is
Prove 0-1-IP
Construction:
(To satisfy
Suppose in 3-CNT-SAT the formula
- if
$x_j \in C_i$ , set$A_{i, j} = -1$ , - if
$\neg x_j \in C_i$ , set$A_{i, j} = 1$ .
Construct a
- if there are
$k$ $\neg$s in$C_i$ , set$b_{i} = k - 1$ .
The construction runs in
3-CNT-SAT $\Rightarrow$ 0-1-IPP:
Based on how we construct
0-1-IPP $\Rightarrow$ 3-CNT-SAT:
By moving back 1s, at least one item in
The integer linear-programming problem is like the 0-1 integer-programming problem given in Exercise 34.5-2, except that the values of the vector
$x$ may be any integers rather than just 0 or 1. Assuming that the 0-1 integer-programming problem is NP-hard, show that the integer linear-programming problem is NP-complete.
Prove ILP
The certificate is
Prove ILP
(Add constrains
Suppose the original
- if
$i <= m$ ,$A'_{i, j} = A_{i, j}$ , - if
$i > m$ and$i - m$ is even,$A_{i, (i - m) / 2} = -1$ , - if
$i > m$ and$i - m$ is odd,$A_{i, (i - m - 1) / 2} = 1$ .
The constructed
- if
$i <= m$ ,$b'_{i} = b_{i}$ , - if
$i > m$ and$i - m$ is even,$b_{i} = 0$ , - if
$i > m$ and$i - m$ is odd,$b_{i} = 1$ .
The construction runs in
Show how to solve the subset-sum problem in polynomial time if the target value
$t$ is expressed in unary.
0-1 knapsack.
dp[0, .., t] = FALSE
dp[0] = TRUE
FOR s IN S
FOR i IN [t, .., 0]
IF dp[i - s] THEN
dp[i] = TRUE
BREAK
RETURN dp[t]
Runs in
The set-partition problem takes as input a set
$S$ of numbers. The question is whether the numbers can be partitioned into two sets$A$ and$\overline{A} = S - A$ such that$\sum_{x \in A} x = \sum_{x \in \overline{A}} x$ . Show that the set-partition problem is NP-complete.
Prove SPP
The certificate is
The verification runs in
Prove SPP
Construction:
Suppose the target is
SUBSET-SUM $\Rightarrow$ SPP:
- if
$t \le s - t$ , we add$s - 2t$ to$A$ , then$\sum_{x \in A} x = t + s - 2t = s - t = \sum_{x \in \overline{A}} x$ , - if
$t > s - t$ , we add$2t - s$ to$\overline{A}$ , then$\sum_{x \in \overline{A}} x = s - t + 2t - s = t = \sum_{x \in A} x$ .
SPP $\Rightarrow$ SUBSET-SUM:
- if
$t \le s - t$ , then the set contains$s - 2t$ is a solution for SUBSET-SUM after removing$s - 2t$ , - if
$t > s - t$ , suppose set$A$ containts$s - 2t$ , then$\overline{A}$ is a solution for SUBSET-SUM.
Show that the hamiltonian-path problem is NP-complete.
Prove HAM-PATH
Given the vertices
-
$v_1 = u$ , -
$v_n = v$ , -
$v_i \ne v_j$ $\forall i, j \in [1, \dots, n]$ , -
$(v_i, v_{i + 1}) \in E \forall i \in [1, \dots, n - 1]$ .
Prove HAM-PATH
Construction:
Choose a vertex
HAM-CYCLE $\Rightarrow$ HAM-PATH:
If there is a hamilton cycle in
HAM-PATH $\Rightarrow$ HAM-CYCLE:
If there is a hamilton path from
The longest-simple-cycle problem is the problem of determining a simple cycle (no repeated vertices) of maximum length in a graph. Formulate a related decision problem, and show that the decision problem is NP-complete.
Decision problem: a simple cycle of size at most
Prove LSC
Given the vertices
-
$v_i \ne v_j \forall i, j \in [1, \dots, n]$ , -
$(v_i, v_{i + 1}) \in E$ $\forall i \in [1, \dots, n - 1]$ , -
$(v_n, v_1) \in E$ .
Prove LSC
HAM-CYCLE is equivalent to solve LSC with
In the half 3-CNF satisfiability problem, we are given a 3-CNF formula
$\phi$ with$n$ variables and$m$ clauses, where$m$ is even. We wish to determine whether there exists a truth assignment to the variables of$\phi$ such that exactly half the clauses evaluate to 0 and exactly half the clauses evaluate to 1. Prove that the half 3-CNF satisfiability problem is NP-complete.
Prove HALF-3-CNF-SAT
Evaluate in
Prove HALF-3-CNF-SAT
Construction:
Suppose
3-CNT-SAT $\Rightarrow$ HALF-3-CNF-SAT:
The original
HALF-3-CNF-SAT $\Rightarrow$ 3-CNT-SAT:
There is no solution if any one of