Reduction: 3SAT → Independent Set
In 3SAT the input is a set of clauses, each with three or fewer literals, e.g.
Goal: Find a satisfying truth assignment.
In INDEPENDENT SET the input is a graph and a number , and the problem is to find a set of pairwise non-adjacent vertices.
How do we transform this problem:
- Represent a clause by a triangle with vertices labeled .
- We choose a triangle because it has three vertices maximally connected, and forces us to pick only one of them for the independent set
- A clause with two literals will be represented simply by an edge joining the literals
- A clause with one literal can be removed in preprocessing step
- Repeat this construction for all clauses
- To force exactly one choice from each clause, take goal to be the number of clauses
- To present from choosing opposite literals, put an edge between any two vertices that correspond to opposite literals
Recovering a solution
- If the graph has independent set solutions
- Given an independent set of vertices in , it is possible to efficiently recover a satisfying truth assignment to .
- For any variable , the set cannot contain vertices labeled both and , because any such pair of vertices is connected by an edge.
- Assign a value of true if contains a vertex labeled , otherwise ( contains vertex ), assign to false.
- Since has vertices, it must have one vertex per clause, it must have one vertex per clause.
- If graph has no independent set of size , then the boolean formula is unsatisfiable
- We’ll prove the contrapositive: If has a satisfying assignment then has an independent set of .
- For each clause, pick any literal whose value under the satisfying assignment is , and add the corresponding vertex to .