0

I'm using Christofides algorithm to calculate a solution for a Traveling Salesman Problem. The implementation is the one integrated in networkx library for Python.

The algorithm accepts an undirected networkx graph and returns a list of nodes in the order of the TSP solution. I'm not sure if I understand the algorithm correctly yet, so I don't really know yet how it determines the starting node for the calculated solution.

So, my assumption is: the solution is considered circular so that the Salesman returns to his starting node once he visited all nodes. end is now considered the node the Salesman visits last before returning to the start node. The start node of the returned solution is random.

Hence, I understand (correct me if I'm wrong) that for each TSP solution (order of list of nodes) with N nodes that is considered circular like that, there are N actual solutions where each node could be the starting node with the following route left unchanged.

A-B-C-D-E-F-G-H->A could also be D-E-F-G-H-A-B-C->D and would still be a valid route and basically the same solution only with a different starting node.

I need to find that one particular solution of all possible starting nodes of the returned order that has the greatest distance between end and start - assuming that that isn't already guaranteed to be the solution that networkx.algorithms.approximation.christofides returns.

Hendrik Wiese
  • 2,010
  • 3
  • 22
  • 49

1 Answers1

0

After reading up a bit more on Christofides, it seems like, due to the minimum spanning tree that's generated as first step, the desired result of the first and last node visited being those along the path that are the furthest apart, is already the case.

Hendrik Wiese
  • 2,010
  • 3
  • 22
  • 49