I would like to know if there is a function in NetworkX to solve the TSP? I can not find it. Am I missing something? I know it's an NP hard problem but there should be some approximate solutions right?
I would like to know if there is a function in NetworkX to solve the TSP? I can not find it. Am I missing something? I know it's an NP hard problem but there should be some approximate solutions right?
Networkx provides an approximate solution to TSP, see page. Their solution is based on writting TSP as Quadratic Unconstrained Binary Optimization (QUBO) problem.
Note that it is proven that finding an alpha-approximation to TSP is proven to be NP-hard in general. So you can't have a guarantee on the quality the obtained result. Howver there is a particular case, Euclidean-TSP, where we can construct 2-approximation and even 1.5-approximation of TSP, using Christofides algorithm however I was not able to find the implementation of this algorithm in Networkx.