I use "Capital cities and borders" dataset from Memgraph Lab for testing. My query traverses all of the capital cities:
MATCH (n:City)
WITH COLLECT(n) AS cities
CALL tsp.solve(cities, "1.5_approx") YIELD sources, destinations
WITH EXTRACT(i IN RANGE(0, SIZE(sources) - 1) | [sources[i], destinations[i]]) AS path
UNWIND path as edge
WITH edge[0] AS from, edge[1] AS to
CREATE (from)-[path:PATH]->(to)
RETURN from, to, path;
I'm ok with the result, but can I define the starting point for TSP algorithm? I want the salesman to start from London.