NP Problem1 PDF
NP Problem1 PDF
• 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 .
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.