Hi. Since 10.0, the TravelingSalesman function was moved to the kernel.
Does anyone know why the following does not work? I've tried to make this example as simple as possible. This has bugged me for a while... Here is a very simple Directed graph. One can travel in either direction from 2_3, but only 1 direction elsewhere. We change 0's to Infinity to avoid self-loops.
data = {{0, 5, 0}, {0, 0, 1}, {1, 1, 0}} /. (0 -> \[Infinity];
g = WeightedAdjacencyGraph[data, VertexLabels -> "Name"];
FindShortestTour[g]
It returns unevaluated with the message: FindShortestTour::ngen: The generalized FindShortestTour[Graph[<3>, <4>]] is not implemented. >>
However, it knows the correct distance to go from 1 to 3, and then 3 back to 1.
GraphDistance[g, 1, 3]
6.
GraphDistance[g, 3, 1]
1.
I've noticed that the edge weights are changed back to zero:
WeightedAdjacencyMatrix[g]//Normal
{{0,5,0},{0,0,1},{1,1,0}}
It also seems to know the Hamiltonian Cycle.
FindHamiltonianCycle[g, All]
{{DirectedEdge[1, 2], DirectedEdge[2, 3], DirectedEdge[3, 1]}}
Thank you in advance for any insight. As a side note, I believe these problems are suppose to be able to handle directed graphs, because one might be able to travel in one direction, and not another. Bridge might be closed in one direction, but not the other. One path might have a heavy penalty because it's uphill, etc.
Thanks again!