# Minimum cost closed walk in a graph

Is there an efficient algorithm which gives the minimum cost closed walk in an undirected graph, which visits all vertices?

Does this problem have a name? I tried to reduce this to similar problems (in particular the traveling salesman problem) to see if it was NP-hard, but was unsuccessful.

Here's an example: Then a possible closed walk is: A,B,C,D,C,B,A, with a cost of 6.

Thanks!

• It seems like this problem is similar to the route inspection problem with the modification that you are interested in exploring all the vertices instead of all the edges. However there does not seem to be a way to reduce this problem to it. – Kaya Jul 14 '13 at 5:17
• What is a minimum distance closed walk? – A.Schulz Jul 14 '13 at 8:03
• I meant minimum cost, updated the question. – simonzack Jul 14 '13 at 8:12
• cstheory "Take a graph with $n$ vertices, put $1$'s on all edges, compute optimum walk. If its weight is $n−1$ then you managed to visit every vertex exactly once, so the graph is Hamiltonian" – Hendrik Jan Jul 14 '13 at 17:26

This problem is equivalent to TSP. Compute all pairwise shortest distances between the vertices in the given graph $G$. Then take the complete graph $K_n$ that is weighted with the shortest-distances of the original graph $G$. The TSP tour of the complete graph corresponds to the shortest min-cost closed walk.
More precisely, a shortest tour $\pi$ in $K_n$ decodes a closed walk in $G$: just replace every edge $(u,v)$ in $\pi$ by the shortest path from $u$ to $v$. Clearly, the costs are preserved. Assume that there would be a shorter closed walk in $G$. Select select the vertices in order they appear first. This permutation implies a tour in $K_n$ (maybe even shorter than the closed walk in $G$), hence we have a contradiction. • I don't see the logic, since $K_n$ is arbitrary, why does replacing edge costs with shortest path costs not change the tour? – simonzack Jul 15 '13 at 11:00