May 2019
Beginner
170 pages
4h 9m
English
Let's say our goal is to reach node 7 from node 1 by accumulating the minimum cost. Let's ask the graph right away what's the shortest path from node 1 to 7:
nx.dijkstra_path(R, 1, 7)
We get the following response:
[1, 4, 6, 7]
This means that the shortest path to reach node 7 from node 1 is through nodes 4 and 6 respectively. The traversal one has to make is as follows: edge 1-4, then edge 4-6 and, finally, edge 6-7.
Read now
Unlock full access