Finding the Dijkstra shortest path with NetworkX in pure Python
This recipe is a pure Python solution to calculate the shortest path on a network. NetworkX is the library we will use with many algorithms to solve the shortest path problem, including Dijkstra (http://networkx.github.io/). NetworkX relies on
scipy to perform some graph calculations and help with performance. In this recipe, we will only use Python libraries to create our shortest path based on the same input Shapefile used in our previous recipe.
Start with installing NetworkX on your machine with the
pip installer as follows:
>> pip install networkx
For the network graph algorithms, NetworkX requires
scipy, so take a look at Chapter 1, Setting Up ...