2 Traveling-salesman problem is NPC•TSP={<G,c,k>: G=(V,E) is a complete graph, cis a function from VVZ, kZ, and G has a traveling salesman tour with cost at most k.} •Theorem 34.14: (page 1012) –TSP is NP-complete. Material from Internet x u v w 4 3 2 5 1 1
3 TSP •TSP belongs to NP: –Given a certificate of a sequence of vertices in the tour, the verifying algorithm checks whether each vertex appears once, sums up the cost and checks whether at most k. in poly time. •TSP is NP-hard (show HAM-CYCLEpTSP) –Given an instance G=(V,E) of HAM-CYCLE, construct a TSP instance <G',c,0) as follows (in poly time): •G'=(V,E'), where E'={<i,j>: i,jV and ij} and •Cost function cis defined as c(i,j)=0 if (i,j) E, 1, otherwise. –If G has a hamiltonian cycle h, thenhis also a tour in G' with cost at most 0. –If G' has a tour h' of cost at most 0, then each edge in h' is 0, so each edge belong to E, so h' is also a hilmitonian cycle in G.