I have read from multiple sources and from my understanding of the algorithm that it runs in 2^N time. My question is what causes TSP to achieve this run time? I can't seem to find a pseudo-code so i can examine it.
Asked
Active
Viewed 1.3k times
0
-
Problems don't have a time complexity. Algorithms have time complexity. There's an inclusion-exclusion algorithm for TSP that runs in `O(2^n * n)` time and space. The time complexity of TSP (if understood as the time complexity of the best algorithm that solves it) is currently unknown. – John Dvorak Nov 15 '12 at 19:06
-
Thank you that is correct I meant algorithms for solving TSP problems. So again, what is it about algorithms like inclusion-exclusion and branch and Bound that cause that run time complexity? – staticFlow Nov 15 '12 at 19:12
1 Answers
3
The algorithm you mean is likely the inclusion-exclusion:
Find the shortest path though the following state space using A*
:
- the state is defined by the partition of the set of cities to the 'visited' set, 'unvisited' set and the 'current' node.
- a valid transition is one that moves one node from 'current' to 'visited' and one from the 'unvisited' to the 'current' set. Its cost is equal the distance from the old 'current' to the new 'current'.
- the starting state is: no city is 'visited', an arbitrary city is 'current'.
- a finishing state is: no city is 'unvisited', any city is 'current'.
The time complexity of inclusion-exclusion is given by the number of states: there is exactly one 'current' city (factor of n
) and all other cities are either visited or unvisited (factor of 2^n
).
The 'A*' algorithm will enter each state at most once. For each state, it will explore at most 'n' other nodes and push them into the priority queue. The priority queue will take at most 'O(n)' time to perform its operation.
Thus, the running time is O(2^n * n * n * O(n))
= O(2^n * poly(n))
. Further insight shows that O(2^n * poly(n))
is equal to O(2^n)
.

John Dvorak
- 26,799
- 13
- 69
- 83
-
no, that's not correct _Further insight shows that `O(2^n * poly(n))` is equal to `O(2^n)`._ – Display Name is missing Jun 28 '16 at 11:53
-
@MithleshUpadhyay How come? I did write a proof but I didn't bother to publish it. Do you have a proof in the opposite direction showing I made a math mistake back then? – John Dvorak Jun 28 '16 at 13:12