List of paths between two points
Mostra commenti meno recenti
I have a list of "Start point" and "End point", and I want to find all shortest paths between a point (let's say the first one) and every other point, there is maximum steps to avoid infinit looping.
Shortly, what I do now is creating a matrix by duplicating all single paths up to the "maximum steps" value, and then looping on steps then selecting for every "End Point" the lines that end with it (the end point) if exists.
For a list of 2^6 * 7 elements, there's 7^6 lines on the resulted matrix, but for 2^n * (n+1) there's n^(n+1) lines. I understand that this is sligntly analogic to the travelling salesman problem, but I just want to know if there's a more economic process to do this. and I only need it to run to the n=20, now I can's go further 6
here's my sample data. Thanks
Risposta accettata
Più risposte (1)
Thiago Henrique Gomes Lobato
il 10 Nov 2019
0 voti
It is not so clear by your list what underlying process you have, but I may assume you have a map (graph) where each point is a node and the nodes are connect by some distance metric (edge) and you want to find the way that minimizes that metric. This is basically a description of a path finding problem. For it there exist some algorithms that do it relatively efficiently as the Dijkstra or A*, they will surely be more memory and time efficient as to list all possible paths .
Here are some links that I founded in file exchange for matlab implementations (I didn't test myself, but should at least give you a direction):
Categorie
Scopri di più su Dijkstra algorithm in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!