Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-cycle path to all nodes

Is there an algorithm or set of algorithms that would let you find the shortest walking distance from an arbitrary start node so that every node gets visited in a weight, undirected graph? It's not quite Traveling Salesman, because I don't care if a node is visited more than once. (It doesn't even matter if you make it back to the start -- the walker can end up in some far-off node as long as it was the last one needed to visit all nodes.) It's not quite minimum spanning tree, because it may be that going A-->B-->C-->A-->D is a (non-unique) shortest path to visit A, B, C, and D. My intuition says that this isn't quite an NP problem, because it doesn't have the restrictions that make NP problems so tricky. I could, of course, be completely wrong.

like image 355
Jon Avatar asked Mar 01 '10 21:03

Jon


People also ask

What is the difference between cycle trail and circuit?

Open walks have different starting and ending nodes. Closed walks, in turn, have the same starting and ending nodes. So, circuits and cycles are closed walks, but not every closed walk is a circuit or cycle. Trails are open walks with no repeated edges in the sequence.

Can a path also be a cycle?

A path in a graph is a sequence of adjacent edges, such that consecutive edges meet at shared vertices. A path that begins and ends on the same vertex is called a cycle. Note that every cycle is also a path, but that most paths are not cycles.

What are path and cycles?

Path: a trail that connects all vertices. Cycle: a trail that finishes on the vertex it begins on. No vertex is repeated. Circuit: a path that begins and ends on the same vertex.

What is the difference between a path and a circuit?

A path in a graph is a succession of adjacent edges, with no repeated edges, that joins two vertices. Definition. A circuit is a path which joins a node to itself.


1 Answers

From Wikipedia's article on Travelling Salesman Problem:

Removing the condition of visiting each city "only once" does not remove the NP-hardness, since it is easily seen that in the planar case there is an optimal tour that visits each city only once (otherwise, by the triangle inequality, a shortcut that skips a repeated visit would not increase the tour length).

like image 137
Larry Avatar answered Sep 21 '22 00:09

Larry