In this section, we will be performing some of the analyses that we did earlier on the new graph, such as the following:
- Dijkstra's shortest path analysis
- Dijkstra's shortest path cost
- Single-source Dijkstra's path length
In this section, we will be performing some of the analyses that we did earlier on the new graph, such as the following:
We have waited so long to perform the shortest path analysis on our graph. So, without further ado, let's run the shortest path algorithm on our graph, optimizing for time. To run the shortest path algorithm, we need to know the source node ID and target node ID. Here, our node IDs are coordinates. Right now, let's pick the node IDs randomly:
nodelist = list(G.nodes())
import random
random.seed...