简体   繁体   中英

Shortest path in a complete weighted undirected graph with a known start node and visiting all nodes without returning to start node

I have a complete undirected graph of locations (nodes), where each edge represents the distance between its connected nodes, and I want to find the shortest path starting from a start node without specifying the end node so basically it can end at any node other then the first one.

I looked through TSP problem and shortest Hamiltonian path but I couldn't find the exact response to my problem .

So what this problem is exactly called or what variant of shortest path problems it is?

This is an exemple of what I am looking for. Lets have a complete weighted graph as follows: 位置图

Each edge represents the distance between two locations for exemple edge AB=5, AC=11......

My goal is to start from node A, and find the shortest path that covers all nodes (shortest possible path) and the end point can be any one other than A. For exemple this path that ends at E: 最短路径

This is a slight variation of a special case of The Traveling Salesman Path Problem . In The Traveling Salesman Path Problem, you're given an undirected graph, a cost function on the edges, and two vertices s and t . The problem is to find a Hamiltonian Path (that is, a path that visits each vertex exactly once) from s to t .

Your problem is the special case in which the input graph is a clique and the destination vertex t is an extra dummy vertex, connected to all other vertices by a 0-cost edge. Clearly, a solution to The Traveling Salesman Path Problem for the graph (with the extra dummy vertex t ) induces a solution to your problem, obtained by simply ignoring the final extra step to the destination t .

Unfortunately, just like the famous Traveling Salesman Problem , The Traveling Salesman Path Problem is not only NP-hard, but also NP-hard to approximate to within any constant factor. However, since your costs represent distances, maybe you could assume that the cost function satisfies The Triangle Inequality ?

If the cost function satisfies The Triangle Inequality, then there exists a recent 1.5-approximation algorithm . If this recent algorithm is an overkill, you can implement one of two simpler algorithms that are nicely described in lecture notes by Professor Ryan O'Donnell from CMU, and settle for either a 2-approximation or a 5/3-approximation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM