topology.tsp_tour : incorrect solution/erratic behaviour depending on source vertex
topology.tsp_tour shows erratic behaviour (Graph-Tool 2.16, Boost 1.60, Ubuntu 14.04, Python 2.7.6), depending on source vertex given.
How to reproduce:
import graph_tool.all as gt
print(gt.tsp_tour(g, g.vertex(1)))
Expected result:
[ 1 2 11 12 21 22 31 32 41 42 51 52 61 62 71 72 81 82 83 73 84 74 85 75
86 76 87 77 88 78 68 58 67 57 66 56 65 55 64 54 63 53 43 33 23 13 3 4 5
6 7 8 89 79 69 59 49 39 48 38 47 37 46 36 45 35 44 34 24 14 25 15 26 16
27 17 28 18 29 19 9 91 92 93 94 95 96 97 98 99 10 20 30 40 50 60 70 80 90
0 1 ]
Actual result:
[ 0 10 20 30 40 50 60 70 80 90 0]
This is neither a TSP tour, nor does it start/end in the source node.
This is a variant of the example given in the documentation (https://graph-tool.skewed.de/static/doc/topology.html#graph_tool.topology.tsp_tour). If using g.vertex(2)
instead of g.vertex(1)
, the result is [0 0]
.