gboeing / osmnx-examples

Gallery of OSMnx tutorials, usage examples, and feature demonstations.
https://osmnx.readthedocs.io
MIT License
1.54k stars 522 forks source link

Use of nx.shortest_path without weight attribute #22

Closed MridulS closed 5 years ago

MridulS commented 5 years ago

All through the examples while calculating shortest_path it looks like the code is calculating the shortest path without taking into account the actual length. nx.shortest_path(G, origin, destination) calculates the shortest path in terms of number of jumps from one node to another node in the graph, to take into account the actual distance between them it should be nx.shortest_path(G, origin, destination, weight='length') to take into account the length of all the edges. Let me know if I am missing something.

gboeing commented 5 years ago

This is discussed in notebook 6 and demonstrated in its cell 13.

MridulS commented 5 years ago

Thanks for the link! :)