This slideshow presents how to reduce a 3-SAT problem instance to an equivalent CLIQUE problem instance in polynomial time.
Given a boolean formula in 3 CNF, the 3-SAT problem is to find whether the formula is satisfiable.
For a given graph G=(V,E) and integer k, the CLIQUE problem is to find whether G contains a clique of size ≥k.
A formula Φ of k three-literal clauses can be reduced to a k-Clique problem in the following way:
Construct a graph G of k clusters with a maximum of 3 nodes in each cluster.
Each cluster corresponds to a clause in Φ.
Each node in a cluster is labeled with a literal from the clause.
An edge is put between all pairs of nodes in different clusters except for pairs of the form (x,¯x)
No edge is put between any pair of nodes in the same cluster.
Construction of cluster of nodes corresponding to clauses in 3 CNF
Φ=
(x2+x1+¯x3)
.
(¯x1+¯x2+x4)
⋅
(x2+¯x4+x3)
¯x1
¯x2
x4
x2
x1
¯x3
x2
¯x4
x3
Connecting the nodes in the graph
1. If two nodes in the graph are connected, the corresponding literals can simultaneously be assigned True. (This is true since there is no edge between nodes corresponding to literals of type x and ¯x.)
2. If two literals not from the same clause can be assigned True simultaneously, the nodes corresponding to these literals in the graph are connected.
3. Construction of the graph can be performed in polynomial time
G has a k-clique if and only if Φ is satisfiable.
1. If the graph G has a k-clique, the clique has exacty one node from each cluster. (This is because no two nodes from the same cluster are connected to each other, hence they can never be a part of the same clique.) All nodes in a clique are connected, hence all corresponding literals can be assigned True simultaneously. Each literal belongs to exactly one of the k-clauses. Hence Φ is satisfiable.
2. If Φ is satisfiable, let A be a satisfying assignment. Select from each clause a literal that is True in A to construct a set S. ||S||=k.Since no two literals in S are from the same clause and all of them are simultaneously True, all the corresponding nodes in the graph are connected to each other, forming a k-clique. Hence, the graph has a k-clique.
The corresponding assignment: x2=True,x3=True,x4=True.
Φ is True for the corresponding assignment: x2=True,x3=True,x4=True.