dssg / hitchhikers-guide

The Hitchhiker's Guide to Data Science for Social Good
986 stars 279 forks source link

Network tutorial: wrong shortest path length #167

Open hsxavier opened 4 years ago

hsxavier commented 4 years ago

The length of the shortest path between nodes 12 and 15 in the Karate network should be:

len(networkx.shortest_path(Graph_Karate, 12, 15)) - 1

because the output of shortest_path includes both the starting and ending nodes. However, the notebooks Introduction_to_Networks_Karate.ipynb and Introduction_to_Networks_clean.ipynb show, instead:

len(networkx.shortest_path(Graph_Karate, 12,15))