- class Tsp(graph)[source]¶
Optimization application for the “traveling salesman problem”  based on a NetworkX graph.
: “Travelling salesman problem”, https://en.wikipedia.org/wiki/Travelling_salesman_problem
graph (Graph | ndarray | List) – A graph representing a problem. It can be specified directly as a NetworkX graph, or as an array or list format suitable to build out a NetworkX graph.
create_random_instance(n[, low, high, seed])
Create a random instance of the traveling salesman problem
Interpret a result as a list of node indices
Read a graph in TSPLIB format from file and return a Tsp instance.
Convert a traveling salesman problem instance into a
Compute the TSP value of a solution.