Lecture 21
Lecture 21
Lecture No. 21
1
NP Complete Problems
We have proved the following reductions:
CIRCUIT-SAT
SAT
3-CNF
Example: Suppose = C1 C2 C3
where C1 = x1 ⌐ x2 ⌐ x3, C 2 = ⌐ x 1 x2 x3
and C3 = x1 x2 x3
G:
Max-Clique
Proof Contd.
• Reduction takes polynomial time
easy to see
Observe
Since each of the 3 vertices corresponding to each
clause are not connected to each other, at most one of
them can be in a clique at a time.
This means the maximum clique size is at most m.
Claim:
is satisfiable if and only if a clique of size m exist in G
Max-Clique
Suppose is satisfiable.
Then each clause has at least one literal that’s assigned
value T.
Let V’ be the set of corresponding vertices.
Then |V’| = m
Claim: V’ is a clique.
Consider any two vertices of V’
1. These vertices corresponds to literals from different
clauses.
2. Since the corresponding literals are assigned value T, the
corresponding literals are consistent.
Therefore, an edge between the two vertices
Hence the claim.
Max-Clique
Conversely, suppose G has a clique V’ of size m.
Since no edges in G connect vertices corresponding to
literals from the same clause,
So V’ contains exactly one vertex corresponding to literals
from each of the m clauses.
Assign value T to each of these m literals.
Observe : Assignment is consistent
Because G contains no edges between inconsistent literals.
Since there is a literal in each clause assigned value T
Each clause is satisfied.
Hence is satisfied
Vertex Cover Problem
Vertex Cover Problem
Let G = (V, E) be an undirected graph.
A subset V’ V is called a vertex cover of G if
(u, v) E, then u V’ or v V’ (or both)
The size of vertex cover is the number of vertices in it.
The Vertex Cover Problem is to find a vertex cover of
minimum size in a given graph.
The Vertex Cover Decision problem is:
Given a graph G and an integer k,
Does G have a vertex cover of size ≤ k?
Vertex Cover Problem
Example: For the following graph G find the vertex
cover
Theorem:
Vertex Cover NPC
Proof:
• Vertex Cover is in NP
Easy to prove
Vertex Cover Problem
Claim: Vertex Cover is NP-hard
For proving this we need the notion of a complement graph.
The complement graph of G= (V, E) is defined by 𝑮 ഥ (𝑽, 𝑬
ഥ)
where
ഥ = {(u, v) : u, v V, u ≠ v, (u, v) E}
𝑬
(It is the graph with all edges that are not in E)
Vertex Cover Problem
Claim: Clique ≤𝑷 Vertex Cover
Reduction Algorithm:
Input is an instance (G, k) of the Clique Problem
The reduction algorithm computes the complement
ഥ
𝑮.
This can be done in polynomial time.
Claim: G has a clique of size k if and only if the
graph 𝑮ഥ has a vertex cover of size |V| - k.
Vertex Cover Problem
Theorem: