如何使用OSMX的shortest_route命令?

huangapple go评论53阅读模式
英文:

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条最短路径,mMapData类型的对象):

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.

huangapple
  • 本文由 发表于 2023年2月23日 23:38:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75547050.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定