Finding Shortest Path through whole points without revisiting

Hi all,
I have a problem and I need urgent help. I have more than 30 points (2D cartesian coordinate) with known x and y coordinates. All points can be distributed randomly or on a regular basis such as star shape or cross shape. I would like to asing a one way path which connects all points without circling or revisiting them. How can I implement this question? I would like to visit each point only once and complete the whole journey as quick as possible.
Thanks in advance.

 Accepted Answer

Bruno Luong
Bruno Luong on 18 Aug 2020
Edited: Bruno Luong on 18 Aug 2020

2 Comments

Note that the request is for a Hamiltonian Path not Travelling Salesman. Travelling Salesman can revisit a point.
"An equivalent formulation in terms of graph theory is: Given a complete weighted graph (where the vertices would represent the cities, the edges would represent the roads, and the weights would be the cost or distance of that road), find a Hamiltonian cycle with the least weight."

Sign in to comment.

More Answers (2)

this problem is known as the Hamiltonian Path
https://www.mathworks.com/matlabcentral/fileexchange/51610-hamiltonian-graph-source-destination

1 Comment

Thank you but I am new at that kind of structures. I could not understand well.
Let's say my points as (x,y)
(1,-1), (0,3), (-1,2), (0,2), (1,1), (1,0), (1,3), (1,5), (2,1), (3,1), (-2,1), (0,0), (-1,0), (3,4), (2,3), (4,1), (2,-1)
I need to find the shortest path covers all those points. It should not visit same point twice (like circles or backlines). It may start from any of them (which is optimum)
I have found something known as Minimal Nearest-Neighbor Closed Contour but in this contour it creates loops on some points. I hope I explained my question clearly.

Sign in to comment.

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!