Shortest path to visit all nodes in a complete directed graph

Note. These are almost the same questions as this one: Shortest path to visit all nodes

But I have a complete schedule.

Problem: Consider a complete undirected graph with non-negative edge lengths. Question. Calculate the shortest path that each node visits at least once .

NB: This is NOT a TSP problem. The path has no end node, and the path can go through the nodes more than once.

Other Notes:

The number of nodes is small (less than 20).

+3


source to share


2 answers


The problem is still NP-Complete (for a solution option), with decreasing Hamiltonian path problem .

Given the instance of the Hamiltonian path problem G=(V,E)

, reduce it to your problem with: G'=(V, E', w)

and the path length |V| - 1

.

Where:



E' = VxV
w(u,v) = 1  if (u,v) is in E
w(u,v) = 2  otherwise

      

  • If G

    there is a Hamiltonian path in, then there is a path in G'

    that costs |V|

    - 1.
  • If in G'

    there is a path that stands |V| - 1

    , then, following these edges in G

    , we get the Hamiltonian Paht.

Thus, the above is a polynomial reduction from the Hamiltonian trajectory to this version of the TSP, and since the Hamiltonian Put problem is NP-Hard, this is also a problem.

+5


source


Statement

The ability to re-view the nodes does not complicate the task.

Description

Suppose we want to find a Galoin path in G. We can turn this into your problem case by setting the edge weights to 1 for edges in G and edge weights to 10 for edges not in G.



We now have a complete graph H with non-negative edges.

The graph G has a Hamiltonian trajectory if and only if we find that the shortest path in H has length n-1.

Recommendations

Therefore your modified problem is NP-hard, so it is unlikely that you can do it better than just adapting standard TSP methods (like the Held-Karp algorithm ) to solve this problem.

+3


source







All Articles