Speedy Route calculates the optimal (best, shortest) driving route when you have lots of places to visit. Beginning at your start location, Speedy Route calculates a route that visits every other location you provide exactly once, before finally returning to your start location to finish, all by the shortest and quickest route possible. Speedy Route also provides the driving directions as supplied by Mapbox for the entire calculated route.

The calculation performed by Speedy Route is an example of a solution to the Travelling Salesman Problem. Speedy Route will attempt to calculate the optimal route for any number of locations (e.g. 10, 20, or many more etc.), but requires at least 4 locations to visit (in addition to your start/finish point) to operate. This is because with less than 3 or 4 locations to visit, there isn't really a problem to solve! This is explained in more detail below:

 If you only have 1 location to visit, then there is only one possible solution. Beginning at your start point, drive to location 1, and then back to the start/finish point (as shown on the right):If you have 2 locations to visit, then there are two possible solutions, shown below. As shown to the left, with 2 locations to visit, there are only two possible solutions. Begin at the start, drive to one of the locations, then on to the other location, and finally return to the start.

When there are at least 3 (or many more) locations to visit, there are several solutions to the problem, and some are clearly much better than others. Take an example of 3 locations to visit, where 2 of those locations are quite close together. Below are several possible different ways to drive from the start location and visit each of the 3 locations exactly once before returning home:

The first two solutions are clearly not good answers. They drive to one of the locations that has another location close by, but drive next to the far away location, and then back to the third, and home. The last solution is obviously much better (shorter and quicker), by visiting the isolated location first, and then onto the other two grouped locations next, and then home. (There is also one more similar solution not shown above, which is simply to drive the loop in the opposite direction).

If you only have 1, 2, or 3 locations to visit, just to put them straight into Google Directions instead!

Speedy Route uses Mapbox to calculate the driving route between each individual location of your route, and therefore if Mapbox cannot provide a driving route between some locations, then we cannot calculate a full route. The most common cause of this error is to have locations that have no route between them, for example between two locations on separate continents, e.g. between New York, USA, and London, UK (because no passenger car ferry service exists between the USA and the UK). Mapbox responds to such requests with the error ZERO_RESULTS, and so Speedy Route displays the Mapbox error as we cannot complete a full route calculation.

Speedy Route calculates the optimal driving route in two stages:

• The driving time (and distance & directions) between each location and its nearest neighbours are calculated using Mapbox, to build up a 'grid' of all the possible routes that exist between all the locations.
• Speedy Route then determines the quickest route out of all the possible routes available. (This stage of the route calculation is commonly described as 'solving the Travelling Salesman Problem').

The second stage described above becomes harder and harder to solve as more locations are added to the route, and so requires more time to complete. If Speedy Route cannot complete the second stage within a reasonable amount of time, the calculation is abandoned as 'TOO_COMPLEX'.