I have a review for the final exam and this question has been particularly confusing for me. I need an example on 3 vertices that the 2 times optimal approximation algorithm for traveling salesman problem (TSP) does not compute a 2 times optimal solution, if the triangular inequality does not hold for the cost. I tried an example with a triangle with costs of sides 1, 1, and 10. However, to get the Hamiltonian cycle, all three sides have to be traversed anyways. Then the optimal solution would be no different than the approximation solution with this algorithm. Am I looking at this all wrong? I would appreciate any help on this.
-
What is `the 2 times optimal approximation algorithm for traveling salesman problem`? – IVlad May 09 '15 at 22:28
-
1Here is the best solution I found http://www.geeksforgeeks.org/travelling-salesman-problem-set-2-approximate-using-mst/. Basically you create a minimum spanning tree and then get a preorder traversal on the spanning tree to get the Hamiltonian cycle that is the solution for the TSP – Kumar May 09 '15 at 22:31
-
Are you sure there's not more to the question? Like maybe the question deals with a hamiltonian path and not a cycle, or it allows for more nodes, or multiple connections between nodes? – IVlad May 09 '15 at 22:41
-
This is the complete question. consider the traveling salesman problem. describe a 2 times the optimal approximation algorithms for solving the TSP, when the triangular inequality hold for the costs assigned to the edges of a complete graph. what is the time complexity of this algorithm? show by an example on 3 vertices that this algorithm does not compute a 2 times optimal solution, if the triangular inequality does not hold for the costs. I am confused on the example part. – Kumar May 09 '15 at 22:59
1 Answers
If you have vertices A, B, C, with edge costs wAB, wAC and wBC, and suppose the triangle inequality doesn't hold. Say wBC > wAB + wAC.
Then, suppose we're starting at A, the approximation algorithm will find a minimum spanning tree with root A. This is:
A
/ \
B C
The solution from the approximation algorithm is the pre-order enumeration of this tree (returning to A), which is A->B->C->A. This has total weight wAB + wBC + wCA. However, the path A->B->A->C->A has weight wAB + wAC + (wAB + wAC) < wAB + wAC + wBC = wAB + wBC + wCA. The < step here uses the original assumption about the triangle inequality not holding.
By picking wBC large enough, we can make the approximation arbitrarily bad (and for example, worse than 2 times optimal). For example, with your weights of 1, 1, 10, the optimal path has total cost 4, but the approximation algorithm gives 12.
The error in your thinking was that, on seeing that the approximation algorithm generates a hamiltonian cycle, inferring that any solution to TSP must be a hamiltonian cycle.

- 54,811
- 11
- 92
- 118
-
Thank you so much for clearing that up. I thought only Hamiltonian cycles were acceptable solutions to the TSP based on the literature at first. What you said make a lot of sense. – Kumar May 10 '15 at 08:11