shortest path for three coordinates

Job ID: 36893475

Budget: $10 – $30 USD

Hi,

is it possible to find the shortest route when we give more than three coordinates in random order using mapbox api or do we need to use Dijkstra’s Algorithm. Attaching sample code


`https://api.mapbox.com/directions/v5/mapbox/cycling/${start[0]},${start[1]};${middle[0]},${middle[1]};${end[0]},${end[1]}?steps=true&geometries=geojson&access_token=${mapboxgl.accessToken}`,
`https://api.mapbox.com/directions/v5/mapbox/cycling/${middle[0]},${middle[1]};${start[0]},${start[1]};${end[0]},${end[1]}?steps=true&geometries=geojson&access_token=${mapboxgl.accessToken}`,

https://www.letsreact.org/use-mapbox-gl-js-in-a-react-app/


.
Thanks
Related categories: JavaScript Algorithm Cartography & Maps HTML React.js