1 | initial version |
Here is a hint : if V
denotes your set of 5 vertices., construct a graph whose vertices is V
and for every par of vertices u
and v
of V
, label the edge (u,v)
with the length of the shortest path between u
and v
in the original graph (use the shortest_path
method). What you want is a TSP in that reduced graph (use the traveling_salesman_problem
method, with the option use_edge_labels=True
.