This is an example of Dijkstra search algorithm usage
Starting from the post I wrote a while ago about Dijkstra's algoritm implmenetion in PHP I though that it would be interesting to write a small practical application for it.
We have a list of 161 cities from Sweden (and 12407 connections between them) gathered from Google and we know the distance between 47.9% of them. Therefore we know the Google's estimated distance between 47.9% of any randomly chosen cities. The question is if we can find another alternative route that gives us a shorter distance than the one provided by Google.
Dijkstra's algorithm helps us in determining the shortest path between two nodes/points on a graph/map and thus we may use it to solve our problem.
Distance calculated by Google: | No data | ||||
The
path calculated with Dijkstra's algorithm goes through: |
|||||