You are on page 1of 15

NP Complete Problems

We have proved the following reductions:


CIRCUIT-SAT

SAT

3-CNF

MAX 2SAT k-CNF Max k-CNF Clique

Vertex Cover

Independent Set Set Cover


Dominating Set
Dominating Set
A dominating set in a graph G = (V, E) is a subset of vertices
V’ such that every vertex in the graph is either in V’ or is
adjacent to some vertex in V’.
Note that we can assume there are no isolated vertices in
G.
Because a graph G with r isolated vertices has a
dominating set of size k iff the graph with those isolated
vertices removed has a dominating set of size k − r.
Since each isolated vertex must be in every dominating
set.
Dominating set
Problem:
Given (G, k) , does a dominating set of size at most k for
G exists?
Theorem:
Dominating set is NPC problem.
Proof:
Dominating set is in NP (Exercise)
Claim:
Vertex Cover ≤𝑷 Dominating-set
Algorithm
Reduction Algorithm
• For each edge (v, w) of G, add a vertex vw and
the edges (v, vw) and (w, vw) to G’
• Remove all vertices with no incident edges;
such vertices would always have to go in a
dominating set but are not needed in a vertex
cover of G
Dominating set
Example

Observe - G’ is constructed from G in polynomial time


Proof
Claim:
G has a Vertex Cover of size k iff G’ has a dominating set of
size k
Let C be a vertex cover of size k in G
• For an old vertex, v ∈ G’
- By the definition of VC, all edges incident to v are covered
- v is also covered
• For a new vertex, uv ∈ G’ :
– Edge u-v must be covered, either u or v ∈ C
– This node will cover uv in G’
• Thus, C is a dominating set for G’
Proof
Conversely, Let D be a dominating set of size k in G’
Case 1 : D contains only vertices from G
Then, all vertices have an edge to a vertex in D
D covers all edges
D is a valid vertex cover of G
Case 2 : D contains some new vertices (vertex in the form of uv)
For each new vertex uv, replace it by u (or v)
If u ∈ D, this node is not needed
Then the edge u-v in G will be covered
D is a valid vertex cover of G (of size at most k)
Hamiltonian Cycle
• For Today
Assume Hamiltonian Cycle Problem is NP Complete
Travelling Salesman Problem
The travelling salesman problem or TSP :
Given a list of cities and the distances between each pair of
cities, what is the shortest possible route that visits each
city exactly once and returns to the origin city?
The problem was first formulated in 1930 and is one of the
most intensively studied problems in optimization.
The corresponding decision traveling salesman problem
can be described as follows:
TSP = {(G, c, k): G = (V, E) a complete graph,
c is a function from V × V → Z,
k ∈ Z,
G has a traveling salesman tour with cost at most k}.
Travelling Salesman Problem

Theorem :
The traveling salesman problem is NP-complete.
Proof :
First, we have to prove that TSP belongs to NP.
In TSP, we find a tour and check that the tour contains
each vertex once.
Then the total cost of the edges of the tour is
calculated and verified if it is at most k
This can be done in polynomial time thus TSP belongs
to NP.
Travelling Salesman Problem
Secondly, we prove that TSP is NP-hard.
Claim : Hamiltonian cycle ≤p TSP
(Assume Hamiltonian cycle problem is NP complete)
Reduction Algorithm:
Assume G = (V, E) to be an instance of Hamiltonian cycle.
An instance of TSP is then constructed as follows.
• We create the complete graph G’ = (V, E’), where
E′ = {(i, j) : i, j ∈ V and i ≠ j}
• We define the cost function c by
𝟎, 𝒊𝒇 𝒊, 𝒋  𝑬
𝒄 𝒊, 𝒋 = ቊ
𝟏, 𝒊𝒇 𝒊, 𝒋 𝑬
Travelling Salesman Problem
Claim:
G has a Hamiltonian cycle if and only if G’ has a tour of
cost at most 0.
Suppose that a Hamiltonian cycle h exists in G.
It is clear that the cost of each edge in h is 0 in G’ as
each edge belongs to E.
Therefore, h has a cost of 0 in G′.
Thus, if graph G has a Hamiltonian cycle then graph G’
has a tour of cost 0.
Travelling Salesman Problem
Conversely,
We assume that G’ has a tour h of cost at most 0.
By definition, the cost of edges in E’ are 0 and 1.
Since cost of h is 0, each edge of h must have a cost 0.
Thus h contains only edges in E.
Therefore h is a Hamiltonian cycle of G.
TSP
Suppose in the reduction algorithm we define
𝟏, 𝒊𝒇 𝒊, 𝒋  𝑬
𝒄 𝒊, 𝒋 = ቊ
𝟐, 𝒊𝒇 𝒊, 𝒋 𝑬
Then the corresponding claim is:
G has a Hamiltonian cycle if and only if G’ has a
tour of cost |V|.
Hamiltonian
Exercise:
1. Longest Simple Cycle is NP Complete

You might also like