Didn't know whether I should ask in coding or here, but I suppose I only ask about an algorithm so here seemed better.

Anyway if I have an unweighted undirected simple Graph and want a spanning closed walk (start and ends at same node, visits every node at least once, can visit nodes several times. Length=number of edges. The shortest possible one is called hamilton walk I think) one Option is to find (one of) the shortest paths between all pairs of nodes, and add edges with the the length of the shortest path to make it a complete weighted graph. Then I can use some TSP algorithm on it and afterwards replace the edges with the corresponding nodes. And I have a relatively short closed walk

But going that way seems a bit weird to me, is there some better alternative? My google abilities seem to fail me.

Edit: Nvm found my confirmation https://books.google.de/books?id=WRIOJFrlZGQC&pg=PA65&lpg=PA65&dq=are+undirected+unweighted+graphs+still+tsp&source=bl&ots=os68eV7KSv&sig=RdW5-bkA76V5R4mr0sJd4sYEXcc&hl=de&sa=X&redir_esc=y#v=onepage&q=are%20undirected%20unweighted%20graphs%20still%20tsp&f=false

## Short spanning closed walk on an unweighted undirected Graph

**Moderators:** phlip, Moderators General, Prelates

### Re: Short spanning closed walk on an unweighted undirected G

The wikipedia article mentions a random algorithm that runs in 1.657^n: https://en.wikipedia.org/wiki/Hamiltonian_path_problem

Pretty sure that's somewhat faster than the algorithm you sketch (which, in the form of the Held-Karp algorithm, is also mentioned in the same article).

Pretty sure that's somewhat faster than the algorithm you sketch (which, in the form of the Held-Karp algorithm, is also mentioned in the same article).

### Who is online

Users browsing this forum: No registered users and 7 guests