CS255
Chris Pollett
May 4, 2022
APPROX-TSP-TOUR(G, c) 1. Select a vertex r to be a root vertex 2. Compute the minimal spanning tree for G from root r using Prim's algorithm 3. Let L be the list of vertices visited in a pre-order tree walk of T 4. return the Hamiltonian cycle H that visits the vertices in order L.
MST-PRIM(G, w, r) // r is a starting node to grow the tree from 01 for each u in G.V 02 u.key = infty 03 u.pi = NIL 04 r.key = 0 05 r.pi = 0; 06 Q = MAKE-QUEUE(G.V) //will have all vertices 07 while Q != 0 08 u = EXTRACT-MIN(Q) 09 for each v in G.adj[u] 10 if v in Q and u.key + w(u, v) < v.key 11 v.pi = u 12 v.key = u.key + w(u,v) //call appropriate DECREASE-KEY
Theorem. APPROX-TSP-TOUR is a p-time 2-approximation algorithm for TSP with triangle-inequality holding on the cost function.
Proof. The minimal spanning tree algorithm runs in time `O(|V|^2)`. The remaining step take at most `O(|G|)` time.
Let `H^star` denote the optimal tour of the vertices. Since we can obtain a spanning tree from any tour by deleting an edge, we have `c(T) le c(H^star)` where `T` is our minimal spanning tree. A full walk `F` of `T` lists the vertices when they are first visited and also whenever they are returned to after a visit to a subtree. So `c(F) = 2c(T) le 2c(H^star)`. A full walk is typically not a tour since it lists some vertices twice.
On the other hand, the `H` returned by the algorithm is a tour and satisfies `c(H) le c(F)`, since it is obtained by deleting vertices from the full walk and since the triangle inequality holds. We are using the triangle inequality as if we have a sequence `a b c` in the full walk and delete `b`, in our tour we want that the cost does not rise.
Theorem. If `P ne NP`, then for any constant `d ge 1`, there is no `p`-time approximation algorithm with approximation ratio `d` for general TSP.
Proof. Suppose that for some number `d ge 1`, there was an approximation algorithm `A` for general TSP with the given approximation ratio. Without loss of generality, we can assume `d` is an integer. We will then show how to use `A` to solve instances of HAM-CYCLE. Since HAM-CYCLE is NP- complete, this will imply the result...
Let `G = (V, E)` be an instance of the HAM-CYCLE problem. Let
`G'= (V, E')` be the complete graph on `V`. Assign a cost to
each edge in `E'` as follows:
`c(u,v) = {(1,mbox(if ){u,v} in E),(d cdot |V| + 1,mbox(otherwise.)):}`
This instance `(G', c)` of the TSP optimization problem can be created in p-time in the HAM-CYCLE instance length. If the original graph has a Hamiltonian cycle, then there is a tour following its edges of cost `|V|`. On the other hand, if no such tour exists, then a tour uses at least one edge not in `E`, so has cost `(d cdot |V| +1) + (|V| - 1) > d cdot |V|`. Since our approximation algorithm needs to find a tour within a factor of `d` of the smallest one, if there is a Hamiltonian cycle in `G` when we run `A` the tour output will have cost `le d cdot|V|`. On the other hand, if the graph G does not have a hamiltonian cycle our algorithm on this instance will return a value `> d cdot|V|`.