I have multiple locations and want to cover all locations with shortest path.I have used google shortest path api but it can works only between two locations.Is there any library or algorithm available for shortest path between multiple locations ?
Asked
Active
Viewed 2,160 times
-1
-
So this means what? You want to visit multiple locations? And find the shortest distance between them? (Based on your edit: try [Traveling Salesman](http://en.wikipedia.org/wiki/Travelling_salesman_problem) problem.) – markspace Jul 17 '14 at 06:12
-
HI, I want to visit multiple locations and want to see on map. – Manoj Tarkar Jul 17 '14 at 06:18
-
hi - is this statement correct: you want to visit all locations and you want to know which route would be the shortest? then maybe you might be interested in http://en.wikipedia.org/wiki/Travelling_salesman_problem – Martin Frank Jul 17 '14 at 07:19
-
Yes Martin,we need exactly same that you are saying. – Manoj Tarkar Jul 17 '14 at 08:02
-
referring to that wiki-pedia articel, the brute force approach is very easy but has a practical limit of 20 locations (if you're using it on a mobil device you should limit the locations to n<=9 because brute force needs n! (n-faculity) routes to calculate...) 9! = 362880 possible routes – Martin Frank Jul 17 '14 at 09:25
-
look at http://stackoverflow.com/questions/2920315/permutation-of-array to find permutation to find all possible routes... – Martin Frank Jul 17 '14 at 09:33
-
why don't you use waypoints with optimize flag? https://developers.google.com/maps/documentation/directions/#Waypoints – Nicholas Ng Jun 25 '15 at 02:37
1 Answers
-3
I'd implement Dijkstra's shortest path algorithm

user3850558
- 12
-
Dijkstra's algorithm is only really applicable to mathematical graphs. It isn't appropriate for physical pathing. – Jul 17 '14 at 20:24
-
Dijkstra's algorithm is fine. There is nothing wrong with it for physical routes, which are calculated on exactly the same sort of graph as any other routes. However, A*, which is a modification of Dijkstra, is faster. – Graham Asher Jul 17 '14 at 21:06