0% found this document useful (0 votes)
35 views18 pages

Lecture 21

The document discusses several NP-complete problems: 1. Max-Clique is proven to be NP-complete by reducing 3-CNF to it. A graph construction is used in the reduction. 2. Vertex Cover is proven to be NP-complete by reducing Clique to it using complement graphs. 3. Independent Set is proven to be NP-complete by reducing Max-Clique to it also using complement graphs.

Uploaded by

f20201862
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views18 pages

Lecture 21

The document discusses several NP-complete problems: 1. Max-Clique is proven to be NP-complete by reducing 3-CNF to it. A graph construction is used in the reduction. 2. Vertex Cover is proven to be NP-complete by reducing Clique to it using complement graphs. 3. Independent Set is proven to be NP-complete by reducing Max-Clique to it also using complement graphs.

Uploaded by

f20201862
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

BITS, PILANI – K. K.

BIRLA GOA CAMPUS

Design & Analysis of Algorithms


(CS F364)

Lecture No. 21

1
NP Complete Problems
We have proved the following reductions:
CIRCUIT-SAT

SAT

3-CNF

MAX 2SAT k-CNF Max k-CNF

We have also proved the 2-CNF is in P


Max-Clique
Max-Clique:
Given a graph G, find the largest clique
Clique: set of nodes such that all pairs in the set are
neighbors OR A clique in G of size k is a complete subgraph
of G on k vertices
Decision problem:
Given G and integer k, does G contain a clique of size ≥ k?
Max-Clique is clearly in NP.
Easy
Theorem :
Max-Clique is NP-Complete
Max-Clique
Proof:
We will prove 3-CNF ≤𝑷 Max-Clique.
Given a 3-CNF formula  of m clauses C1, C2,….., Cm
and over n variables x1, x2,….., xn
We construct a graph G as follows:
1. for each clause Cr = 𝒍𝒓𝟏  𝒍𝒓𝟐  𝒍𝒓𝟑 , create one vertex for
each of 𝒍𝒓𝟏 , 𝒍𝒓𝟐 , 𝒍𝒓𝟑
2. Place an edge between two vertices 𝒍𝒓𝒊 and 𝒍𝒔𝒋 if and only if
• r ≠ s, i.e., the corresponding literals are from different
clauses
• 𝒍𝒓𝒊 ≠ ⌐ 𝒍𝒔𝒋 i.e., they are consistent
Max-Clique

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

Suppose that G has a Clique V’  V with |V’| = k


Claim: V – V’ is a vertex cover in 𝑮ഥ.
Let (u, v)  𝑬

Then (u, v)  E
 At least one of u or v does not belong to V’
(because V’ is a clique, every pair of vertices in V’ is
connected by an edge of E)
 At least one of u or v belongs to V - V’
 (u, v) is covered by V- V’
 V- V’ is a vertex cover of 𝑮ഥ of size |V| - k
Vertex Cover Problem
Conversely, suppose that 𝑮 ഥ has a vertex cover V’  V,
where |V’| = |V| - k
Claim: V – V’ is a clique in G
Suppose u, v  V – V’
 u, v  V’
 (u, v)  𝑬

Because V’ is an vertex cover of 𝑮 ഥ and so covers every

edge in 𝑬
(u, v)  E
 V – V’ is a clique in G of size k
Independent Set
An independent set is a set I ⊆ V of vertices such that
for all u, v ∈ I, (u, v)  E
OR
No pair of vertices in I are connected by an edge
An independent set problem is to find a maximum size
independent set in G.
The independent set decision problem is as follows:
Given a graph G and an integer k,
Is there an independent set I of vertices of size at most
k?
Independent Set
Theorem:
Independent Set is NP-Complete.
Proof:
1. Independent Set  NP
Easy to Prove
2. Independent Set is NP-hard
Claim: Max-Clique ≤𝑷 Independent Set
Reduction Algorithm:
Given G and k, compute the complement graph 𝑮 ഥ
ഥ has
Claim: G has a clique of size k if and only if the graph 𝑮
a independent set of size k.
Independent Set
Assume that there exists a clique C of size k in G.
Thus, for any u, v ∈ C, (u, v) ∈ E.
Thus, (u, v)  𝑬

Thus, the vertices in C form an independent set of size k in

𝑮
Conversely, assume that there exists an independent set I

of size k in 𝑮
Let u, v ∈ I
Then (u, v)  𝑬ഥ
Thus, (u, v) ∈ E.
Thus, the vertices in I form a clique of size k in G.
Relationship between Clique, VC, and IS

Theorem:

You might also like