英文:
How to use shortest_rout command of OSMX?
问题
如何运行地图数据的最短路径?
shortest_route(m::MapData, node1::Int, node2::Int; routing::Symbol = :astar)
我们需要用什么替代 routing 和 symbol?
是否有可能获得 k 条最短路径?
英文:
how to run the Shortest path for a mapdata?
shortest_route(m::MapData, node1::Int, node2::Int; routing::Symbol = :astar)
what do we need to substitud as routing and symbol??
Is there any possiblity to have k shoretest path?
答案1
得分: 2
当前参数routing可以有两个值之一::astar或:dijkstra,分别将使用适当的算法。
要获取k最短路径,目前需要使用Graphs.jl。距离存储在w字段中,因此你可以执行以下操作(假设你想要在节点2341328633和52831601之间找到3条最短路径,m是MapData类型的对象):
Graphs.yen_k_shortest_paths(m.g, m.v[2341328633], m.v[52831601], m.w, 3)
字段v存储有关将OSM节点映射到MapData对象中的g字段中的SimpleDiGraph顶点的信息,而w是包含距离的稀疏矩阵。
英文:
Currently the parameter routing can have one of two values: either :astar or :dijkstra and the appropriate algorithm will be use respectively.
Currently in order to get k-shortest route you would need to use Graphs.jl. The distances are stored in the w field hence you could do (assuming you want to have 3 shortest paths between nodes 2341328633 and 52831601 and m is an object of MapData type):
Graphs.yen_k_shortest_paths(m.g, m.v[2341328633], m.v[52831601], m.w,3)
The field v stores information about mapping OSM nodes to vertices of SimpleDiGraph stored in the field g within a MapData object, and w is a sparse matrix with distances.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论