![](/img/trans.png)
[英]Python: NetworkX Finding shortest path which contains given list of nodes
[英]finding way ids for list of osm nodes in shortest path
在一條路線中,我們獲得了從源到目的地的所有節點的列表。
route = nx.shortest_path(G,origin_node,desitination_node, weight='length')
是否可以從源到目的地獲取所有osm方式ID?
是的,路由是節點列表。 成對遍歷此列表以獲取邊緣(u,v)元組(例如,請參見https://stackoverflow.com/a/4628446/7321942 )。 在圖中查找那些邊緣元組,以獲取與那些邊緣相對應的OSM方式ID。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.