Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Networkx Traveling Salesman Problem (TSP)

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?

like image 458
bottledatthesource Avatar asked Jan 23 '20 21:01

bottledatthesource


People also ask

What is Travelling sales person problem TSP )? How is it solved?

The traveling salesman problem (TSP) is an algorithmic problem tasked with finding the shortest route between a set of points and locations that must be visited. In the problem statement, the points are the cities a salesperson might visit.

Why is the Travelling sales person problem TSP considered a challenging problem?

This means that TSP is classified as NP-hard because it has no “quick” solution and the complexity of calculating the best route will increase when you add more destinations to the problem. The problem can be solved by analyzing every round-trip route to determine the shortest one.

Can travelling salesman problem solved using minimum spanning tree?

MST is a relaxed problem of TSP, So you can use MST solution as a heuristic function for TSP, Because It always estimate a solution with less cost than real solution. Your question's answer is "no". you can't use MST solutions for TSP.

Is travelling salesman problem a NP or P problem?

The travelling salesman problem (also called the travelling salesperson problem or TSP) asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city?" It is an NP-hard problem in ...


1 Answers

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.

like image 59
hola Avatar answered Oct 10 '22 21:10

hola