[英]k-shortest (alternative) path algorithm, java implementations
Could you recommend any java library which implements k-shortest algorithm -> searching for alternative ways, not the only shortest one in directed multigraph ? 你能推荐任何实现k-shortest算法的java库 - >搜索替代方法,而不是定向多图中唯一最短的方法吗?
I found only JGraphT but there is actually bug (which i submitted) but it will take a lot of time to fix it i guess, are there any other available implementations ? 我发现只有JGraphT,但实际上有bug(我提交了)但是我需要花很多时间修复它,是否有其他可用的实现? Except JGraphT i found only small one-man projects :/ 除了JGraphT,我发现只有小型单人项目:/
OR would be hard to modify Disjktra shortest path alg to show alternative paths ? 或者很难修改Disjktra最短路径alg以显示替代路径?
Thanks 谢谢
2 Possible Options: 2个可能的选择:
Option 1. The class KshortestPath
from the MascOpt Package is a good option for a Java implementation of k-shortest paths. 选项1. MascOpt包中的class KshortestPath
是k- shortest路径的Java实现的一个很好的选择。
Option 2. You can also try this from code.google.com This seems to be a one person's effort, but the good thing is that the algorithm is shared: Yen's Ranking - the details are here.( http://www.ohloh.net/p/k-shortest-paths ) 选项2.你也可以从code.google.com尝试这个。这似乎是一个人的努力,但好的是该算法是共享的:Yen的排名 - 详情在这里。( http://www.ohloh .net / p / k-shortest-paths )
Note : Finding the shortest-paths between all pairs of nodes in a given graph is a different problem. 注意 :查找给定图形中所有节点对之间的最短路径是一个不同的问题。 See this SO question on Dijkstra vs. Floyd-Warshall . 在Dijkstra对阵Floyd-Warshall看到这个问题。
Also note that k-shortest paths
for rich graphs tend to be slight variations of the (Dijkstra) shortest path - alternative paths between vertices on the shortest-path with slightly higher costs. 还要注意,富图的k-shortest paths
往往是(Dijkstra)最短路径的微小变化 - 最短路径上的顶点之间的替代路径,成本稍高。
I know the OP asked for Java implementations but if people have a choice and R is an option, then the kBestShortestPaths
package from CRAN is a very good option as well. 我知道OP要求Java实现,但是如果人们有选择而R是一个选项,那么来自CRAN的kBestShortestPaths
包也是一个非常好的选择。
Hope that helps. 希望有所帮助。
Finding the k-shortest paths is related but not the exact same problem as alternative paths. 找到k最短路径是相关的,但不是与替代路径完全相同的问题。 Good alternative paths are more complicated. 好的替代路径更复杂。 Have a read where other similar approaches are outlined: 阅读其他类似方法的概述:
The plateau method is a bit illustrated here . 高原方法在这里有点说明。
If it is possible for you to read German then this lecture is nice : 如果您有可能阅读德语,那么这个讲座很棒 :
Page 5 第5页
So intuition tells us: an alternative should have nearly identical distance or time. 所以直觉告诉我们:替代方案应该具有几乎相同的距离或时间。 but should be significant different. 但应该是显着不同的。 so the first idea: find a path which minizes length AND similarity. 所以第一个想法:找到一个缩小长度和相似性的路径。 Problem: there could be local detours. 问题:可能有当地的弯路。
Page 6 第6页
we introduce a 3rd criterion: local optimumality : every short subpath needs to be a shortest path. 我们引入第三个标准: 局部最优 :每个短子路径都需要是最短路径。
There has been a similar request before, but looking for all paths on StackOverflow. 之前有类似的请求,但在StackOverflow上查找所有路径。 Find all paths in a graph with DFS 使用DFS查找图形中的所有路径
Hope this helps, it was answered but not with the exact solution, but more of a guide 希望这有所帮助,它得到了回答,但没有得到确切的解决方案,而是更多的指南
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.