You are on page 1of 14

All NP-Complete Problems can be reduced to each other

Euler Cycle (EC)


1. The problem is about finding a cycle in a given graph that visits each edge exactly once
and returns to the starting vertex.
2. The problem belongs to the P complexity class, as there are polynomial-time algorithms
like Fleury's and Hierholzer's algorithms.
3. The decision variant is deciding whether such a cycle exists in the graph.
4. EC can be reduced to the Euler Path problem.

Euler Path (EP)


1. The problem is about finding a path in a given graph that visits each edge exactly once.
2. The problem belongs to the P complexity class, as there are polynomial-time algorithms
like Fleury's and Hierholzer's algorithms.
3. The decision variant is deciding whether such a path exists in the graph.
4. EP can be reduced to the Euler Cycle problem by adding an edge.

Hamilton Cycle (HC)


1. The problem is about finding a cycle in a given graph that visits each vertex exactly once
and returns to the starting vertex.
2. The problem belongs to the NP-Complete complexity class.
3. The decision variant is Hamiltonian Cycle Decision Problem (HCDP), which asks
whether a Hamiltonian cycle exists in the graph.
4. HC can be reduced to the Travelling Salesman Problem (TSP) and other NP-Complete
problems.
Hamilton Path (HP)
1. The problem is about finding a path in a given graph that visits each vertex exactly once.
2. The problem belongs to the NP-Complete complexity class.
3. The decision variant is Hamiltonian Path Decision Problem (HPDP), which asks whether
a Hamiltonian path exists in the graph.
4. HP can be reduced to the Hamilton Cycle problem and other NP-Complete problems.

Clique
1. The problem is about finding a subset of vertices in a given graph such that every pair of
vertices in the subset is connected by an edge.
2. The problem belongs to the NP-Complete complexity class.
3. The decision variant is Clique(k), which asks whether a clique of size k exists in the
graph.
4. Clique can be reduced to problems like Vertex Cover, Independent Set, and other
NP-Complete problems.

Isolated Set (IS)


1. The problem is about finding a subset of vertices in a given graph such that no two
vertices in the subset are connected by an edge.
2. The problem belongs to the NP-Complete complexity class.
3. The decision variant is Isolated IS(k), which asks whether an isolated set of size k exists
in the graph.
4. IS can be reduced to problems like Clique, Vertex Cover, and other NP-Complete
problems.

Vertex Cover (VC)


1. The problem is about finding the smallest subset of vertices in a given graph such that
each edge is connected to at least one vertex in the subset.
2. The problem belongs to the NP-Complete complexity class.
3. The decision variant is Vertex Cover(k), which asks whether a vertex cover of size k
exists in the graph.
4. VC can be reduced to problems like Clique, Independent Set, and other NP-Complete
problems.

Chromatic Number (CN)


1. The problem is about finding the minimum number of colors required to color a given
graph such that no two adjacent vertices have the same color.
2. The problem belongs to the NP-Complete complexity class.
3. The decision variant is Chromatic Number(k), which asks whether the graph can be
colored with k or fewer colors such that no two adjacent vertices have the same color.
4. CN can be reduced to problems like 3-Coloring and other NP-Complete problems.

Graph Isomorphism (GI)


1. The problem is about determining whether two given graphs are isomorphic, meaning
they have the same structure but possibly with different vertex labels.
2. The problem belongs to the NP complexity class, but its exact position is unknown. It is
not known to be in P, NP-Complete, or co-NP-Complete. Has Certification Algorithm
which is P.
3. The decision variant is deciding whether the two input graphs are isomorphic.
4. GI can be reduced to Subgraph Isomorphism but other NP-Complete problems are not
known to be reduced to GI.

Subgraph Isomorphism (SGI)


1. The problem is about determining whether a given graph G1 is a subgraph of another
graph G2, meaning there is an isomorphism between G1 and a subgraph of G2.
2. The problem belongs to the NP-Complete complexity class.
3. The decision variant is deciding whether such an isomorphism exists.
4. SGI can be reduced to problems like Graph Isomorphism, Maximum Common
Subgraph, and other NP-Complete problems.

Traveling Salesman Problem (TSP)


1. The problem is about finding the shortest possible route for a salesman who must visit a
set of cities exactly once and return to the starting city.
2. The problem belongs to the NP-Hard complexity class. Its decision variant is
NP-Complete.
3. The decision variant is TSP(k), which asks whether there exists a tour of length k or less.
4. TSP(k) can be reduced to problems like Hamilton Cycle, Integer Linear Programming,
and other NP-Complete and NP-Hard problems.

SAT
1. The problem is about determining the satisfiability of a given propositional logic formula,
i.e., whether there exists a variable assignment that makes the formula true.
2. The problem belongs to the NP-Complete complexity class.
3. The decision variant is deciding whether the input formula is satisfiable.
4. SAT can be reduced to many other problems, as it was the first problem proven to be
NP-Complete. Examples include 3SAT, Vertex Cover, and Clique.

2SAT
1. The problem is about determining the satisfiability of a given propositional logic formula,
where each clause has exactly two literals.
2. The problem belongs to the P complexity class, as there are polynomial-time algorithms
like the 2SAT algorithm based on strongly connected components.
3. The decision variant is deciding whether the input 2SAT formula is satisfiable.
4. 2SAT cannot be reduced to NP-Complete problems in general, as it is in P.

3SAT
1. The problem is about determining the satisfiability of a given propositional logic formula,
where each clause has exactly three literals.
2. The problem belongs to the NP-Complete complexity class.
3. The decision variant is deciding whether the input 3SAT formula is satisfiable.
4. 3SAT can be reduced to many other NP-Complete problems, like Vertex Cover, Clique,
and Hamilton Cycle.

3SAT reduce to everything,

Proof of every Problems Complexity

P:

Euler Cycle (EC) and Euler Path (EP):


These problems can be solved in polynomial time using Fleury's and Hierholzer's algorithms,
which have well-defined polynomial-time complexity. Hierholzer's algorithm, in particular, has a
time complexity of O(|E|), where |E| is the number of edges in the graph.

2SAT:
2SAT can be solved in polynomial time using an algorithm based on finding strongly connected
components in the implication graph. The algorithm consists of the following steps: (1) construct
the implication graph, (2) find its strongly connected components using Tarjan's or Kosaraju's
algorithm, both of which are polynomial-time, (3) check the satisfiability condition. The overall
time complexity is polynomial.

NP-Complete:

SAT:
The proof of SAT being NP-Complete is based on Cook-Levin theorem. The theorem states that
SAT is NP-Complete, and the proof demonstrates that any problem in NP can be reduced to
SAT in polynomial time. The reduction involves encoding the computation of a non-deterministic
Turing machine as a SAT formula.

3SAT:
3SAT is a special case of SAT, where each clause has exactly three literals. To show that 3SAT
is NP-Complete, it is sufficient to reduce SAT to 3SAT in polynomial time. This reduction
involves transforming any given SAT formula into an equivalent 3SAT formula using additional
variables and clauses.

For the remaining NP-Complete problems (HC, HP, Clique, IS, VC, CN, and SGI), the proofs of
their NP-Completeness typically involve reducing another known NP-Complete problem to the
given problem in polynomial time. For example:
Hamilton Cycle (HC) and Hamilton Path (HP):
To show that HC is NP-Complete, we can reduce the NP-Complete problem of 3SAT to it. The
reduction involves constructing a graph based on the 3SAT instance, such that the graph has a
Hamiltonian cycle if and only if the 3SAT instance is satisfiable. A similar reduction can be
constructed for HP.

Clique, Isolated Set (IS), and Vertex Cover (VC):


1. Clique is proven to be NP-Complete by reducing 3SAT to it. The reduction involves
constructing a graph with a special structure that has a k-clique if and only if the 3SAT
instance is satisfiable.
2. The Isolated Set problem can be shown to be NP-Complete by reducing the Clique
problem to it. The complement graph of a graph with a k-clique has a k-isolated set, and
this transformation can be done in polynomial time.
3. Vertex Cover can be proven NP-Complete by reducing the Clique problem to it. Given a
graph G and an integer k, the graph G has a k-clique if and only if its complement graph
has a vertex cover of size |V| - k, where |V| is the number of vertices in the graph.

Chromatic Number (CN):


CN can be proven NP-Complete by reducing 3-Coloring to it. Given a graph G, we can ask if it
has a chromatic number of 3, which is equivalent to solving the 3-Coloring problem.

Subgraph Isomorphism (SGI):


SGI can be proven NP-Complete by reducing the Clique problem to it. Given a graph G and an
integer k, we can construct a graph H that is the union of k complete graphs of size k, each
corresponding to a k-clique. The graph G has a k-clique if and only if H has a subgraph
isomorphic to G. This reduction can be done in polynomial time.

NP:

Graph Isomorphism (GI):


GI is known to be in NP, as given a proposed isomorphism between two graphs, it is easy to
verify in polynomial time whether the isomorphism is valid. However, the exact position of GI
within NP is unknown, as it has not been proven to be in P, NP-Complete, or co-NP-Complete.
NP-Hard (Decision variant is NP-Complete):

Travelling Salesman Problem (TSP):


TSP is proven to be NP-Hard by showing that the Hamiltonian Cycle problem can be reduced to
it. Given a graph G, we can construct an instance of TSP by assigning weights to the edges:
weight 1 for the edges in G and a large weight (e.g., |V|+1, where |V| is the number of vertices)
for the edges not in G. The graph G has a Hamiltonian cycle if and only if there is a tour in the
TSP instance with total weight equal to |V|. The decision variant of TSP (deciding whether a tour
of length k or less exists) is NP-Complete, as the reduction from Hamiltonian Cycle is
polynomial
Reducing

1. IS to clique
To reduce the independent set (IS) problem to the clique problem, we construct a complement
graph G'=(V, E') where E' consists of all possible edges that are not present in G. Then, any set of
vertices that forms an independent set in G is a set of vertices that forms a clique in G', and vice
versa. Thus, we can solve the independent set problem in G by finding a maximum clique in G'. The
set of vertices corresponding to the maximum clique in G' will be a maximum independent set in G.

Pseudo code:
Input: A graph G = (V, E)

1. Construct the complement graph G' = (V, E')


where E' consists of all possible edges that are not present in E.

2. Find a maximum clique C in G'


using any standard algorithm for the clique problem.

3. The set of vertices corresponding to C in G is a maximum


independent set in G.

Output: A maximum independent set in G.

2. Clique to IS

To reduce the clique problem to the independent set problem, we can construct the
complement graph of the input graph and find a maximum independent set in it. The
largest independent set in the complement graph will correspond to the largest clique in
the original graph.
Here's the pseudocode for this reduction
3. Redusicg 2-Sat to 3-Sat:

To reduce a 2-SAT problem to a 3-SAT problem in polynomial time, you need to convert
each clause containing two literals into one or more clauses containing three literals.
You can accomplish this by introducing a new variable for each clause and using it to
create two new 3-SAT clauses.

Example:
2-sat: (a v b)^ (-a v b)
3-sat: (a V b V x1) ^ (a V b V -x1) ^ (-a V b V x2) ^ (-a V b V -x2)

This transformation can be done in polynomial time, as it only needs to iterate through the
clauses once and create two new clauses for each original clause.

4. sat to 3-sat

The reduction from SAT to 3SAT aims to transform any given Boolean formula in conjunctive
normal form (CNF) to an equivalent formula where each clause has exactly three literals. Here's
a pseudocode for the reduction:
Given a Boolean formula in CNF form for the SAT problem, we need to convert it into an
equivalent 3-SAT formula. To do this, we can perform the following steps for each clause in the
SAT formula:

If a clause has only one literal, say x, we can introduce two new variables, say a and b, and
rewrite the clause as (x OR a OR NOT a) and (x OR b OR NOT b). This maintains the original
satisfiability because the newly introduced variables essentially cancel each other out.

If a clause has two literals, say (x OR y), we can introduce a new variable, say a, and rewrite the
clause as (x OR y OR a) and (x OR y OR NOT a). This maintains the original satisfiability as at
least one of the new clauses will always be true, regardless of the value of a.

If a clause has more than three literals, say (x1 OR x2 OR x3 OR x4 OR ... OR xn), we can
introduce new variables to break it down into multiple 3-literal clauses. For example, we can
rewrite the clause as:

(x1 OR x2 OR a1) AND


(NOT a1 OR x3 OR a2) AND
(NOT a2 OR x4 OR a3) AND
...
(NOT a(n-4) OR x(n-1) OR xn)
Here, the new variables a1, a2, ..., a(n-4) are introduced to maintain the original satisfiability.

Let's see an example:

Given the SAT problem in CNF form: (x1 OR x2) AND (NOT x1 OR x3 OR NOT x2) AND (x3)

We can convert it into a 3-SAT problem as follows:

The first clause has two literals, so we introduce a new variable a and rewrite it as (x1 OR x2 OR
a) AND (x1 OR x2 OR NOT a).

The second clause already has three literals, so we keep it as is: (NOT x1 OR x3 OR NOT x2).

The third clause has only one literal, so we introduce two new variables b and c and rewrite it as
(x3 OR b OR NOT b) AND (x3 OR c OR NOT c).

The final 3-SAT formula is: (x1 OR x2 OR a) AND (x1 OR x2 OR NOT a) AND (NOT x1 OR x3 OR
NOT x2) AND (x3 OR b OR NOT b) AND (x3 OR c OR NOT c).
Suppose we have a SAT problem with a clause containing four literals: (x1 OR x2 OR x3 OR x4).
We want to convert this clause into an equivalent set of clauses, each containing exactly three
literals.

To do this, we'll introduce new variables to break the original clause into a series of smaller
clauses. Let's introduce a new variable a1. We'll use this variable to connect two 3-literal
clauses:

(x1 OR x2 OR a1) AND (NOT a1 OR x3 OR x4)


Now, let's analyze the satisfiability of the new clauses. The original clause (x1 OR x2 OR x3 OR
x4) is satisfied if at least one of the variables x1, x2, x3, x4 is true. In the new clauses, if any of
x1, x2 is true, the first clause (x1 OR x2 OR a1) is true, and it doesn't matter what value a1 takes
since the second clause (NOT a1 OR x3 OR x4) will be true as long as any of x3, x4 is true. If x1,
x2 are both false, a1 must be true to satisfy the first clause, and in that case, the second clause
is satisfied if any of x3, x4 is true.

Thus, we've reduced the original 4-literal clause into two 3-literal clauses while maintaining its
satisfiability.

In general, for a clause with n literals (x1 OR x2 OR ... OR xn), we can introduce n-3 new variables
a1, a2, ..., a(n-3) and create a series of 3-literal clauses like this:

(x1 OR x2 OR a1) AND


(NOT a1 OR x3 OR a2) AND
(NOT a2 OR x4 OR a3) AND
...
(NOT a(n-4) OR x(n-1) OR xn)
By using this method, we can reduce any clause with more than three literals to a series of
3-literal clauses, ultimately reducing the entire SAT problem to a 3-SAT problem.
5. Reduce HC to TSP(k)

6. Reduce CN to IS
7. Reduce IS to Clique

8. cReduce IS to CN
3SAT to NPC
1. 3SAT to HC

Proof

1. Proof that P is subset of NP

Let's consider any problem A that belongs to P. Since A is in P, there exists a


polynomial-time algorithm that can solve it. Furthermore, this algorithm is deterministic,
which means that it can also be used to verify a solution in polynomial time. If we are
given a candidate solution for problem A, we can simply run the polynomial-time
algorithm to see if it produces the same output as the candidate solution. If it does, then
the candidate solution is correct; otherwise, it is incorrect.

Thus, any problem A in P can also be verified in polynomial time, and therefore belongs
to NP. This demonstrates that P is a subset of NP (P ⊆ NP).

2. proof that every NP complete language is infinite

Proof that for example 3sat can be reduced to 4sat and etc

3.

You might also like