dwave.graphs.algorithms.tsp.is_hamiltonian_path#
- is_hamiltonian_path(graph: Graph, route: Iterable[Hashable]) bool[source]#
Determines whether the given list forms a valid TSP route.
A traveling salesperson route must visit each city exactly once.
- Parameters:
graph – The graph on which to check the route.
route – List of nodes in the order that they are visited.
- Returns:
True if route forms a valid traveling salesperson route.