0% found this document useful (0 votes)
46 views2 pages

NP Problem1 PDF

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)
46 views2 pages

NP Problem1 PDF

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/ 2

Example reduction We reduce the Hamiltonian path problem (HPP) to

the traveling salesman problem (TSP). We show this by an intermediate


reduction for the Hamiltonian cycle/circuit problem (HCP). HCP is almost
the same as HPP, only that we want a cycle now (i.e., the path should start
and end at the same vertex, i.e., one vertex is visited twice). Obviously, HCP
is also an NP problem (why?).

(a) Show HPP ≤p HCP.


Construction:
input: finite graph G = (V, E)
output: finite graph G0 = (V 0 , E 0 ) with

• V 0 = V ∪ {v0 }, v0 ∈
/ V , so we have the old vertices plus one extra
vertex v0
• E 0 = E ∪ {(v, v0 ) | v ∈ V }, so we have the old edges plus an edge
from every old vertex to v0 .

This construction is total (recognizing a proper input is simple) and


computable in polynomial time (we need to add one vertex and |V |
edges, possible in O(|V | + |E|)).
We need to show that G ∈ HPP ⇔ (G0 , k) ∈ HCP.
“⇒” If there is a Hamiltonian path in G, say, from v1 to v2 , then we
can close the cycle by taking the edge (v2 , v0 ) to v0 , followed by taking
the edge (v1 , v0 ) to v1 in G0 .
“⇐” If there is a Hamiltonian cycle G0 , then every vertex is visited ex-
actly once, especially v0 . We find a Hamiltonian path in G by removing
those two transitions from and to v0 on the cycle.

(b) Show HCP ≤p TSP.


Construction:
input: finite graph G = (V, E)
output: tuple (G0 , k), where

• G0 = (V, E 0 ) is a complete graph with E 0 has all edges from E


with weight 1 and all possible edges not in E with weight 2
• k = |V | is a natural number equal to the number of vertices.

5
This construction is total (recognizing a proper input is simple) and
computable in polynomial time (there are O(|V |2 ) possible edges).
We need to show that G ∈ HCP ⇔ (G0 , k) ∈ TSP.
“⇒” If there is a Hamiltonian cycle in G, then there is a tour in G0 of
weight k, namely the same cycle.
“⇐” If there is a tour in G0 of weight k, it means that every edge has
weight 1. This means these edges were already present in G, so we have
a Hamiltonian cycle in G, namely the same as the tour.

(c) We have shown HPP ≤p HCP ≤p TSP. Because HPP is known to be


NP-complete and thus NP-hard, we have shown that HCP and TSP
are NP-hard. Since HCP and TSP are NP problems, they are even
NP-complete.

Some NP-complete problems can be slightly modified and then polynomially


solved. For instance, the Eulerian path problem asks for a path through a
graph which visits each edge exactly once (compare to the Hamiltonian path
problem). This is polynomially solvable (linear in the size of the graph).
A typical way to tackle NP-complete problems in practice is finding good
heuristics. Remember that lower bounds only have to hold for some in-
stances, so many instances might be simple to solve.
There exist important NP-complete problems for which very good approx-
imation algorithms (e.g., the result is always at most 10% away from the
optimum) or probability algorithms (e.g., the result is correct in 90% of all
cases) are known.

§3 The satisfiability problem for Boolean expressions


(pp. 133-138)
We skip this part in the interest of time.
Summary: The “mother of all NP-complete problems”, SAT, is proven to be
NP-complete. The proof is not very hard, but very technical.

You might also like