DeltaStepping算法是否返回与Dijkstra算法相同的结果

问题描述

我正在使用Java图形库JGraphT计算权重为非负的有向加权Graph上的最短路径。

目前,我正在使用DijkstraShortestPath。哪个效果很好,但我需要提高性能。 我尝试用DeltaSteppingShortestPath替换算法,这是解决Sssp问题的并行实现。 它们都实现了相同的接口ShortestPathAlgorithm。

虽然Dijkstra找到了一条从A到B的路径,但DeltaStepping却没有。

这是结果是否有所不同的通常行为吗?

我正尝试尽快提供代码示例以重现此问题 更新:重现错误

DirectedWeightedMultigraph<String,DefaultWeightedEdge> graph = new DirectedWeightedMultigraph<>(DefaultWeightedEdge.class);
graph.addVertex("v0");
graph.addVertex("v1");
graph.addVertex("v2");
graph.addVertex("v3");
graph.addEdge("v0","v1");
graph.addEdge("v1","v2");
graph.addEdge("v2","v3");

# this returns a result
new DijkstraShortestPath<>(graph).getPath("v0","v3")

# this returns null
new DeltaSteppingShortestPath<>(graph).getPaths("v0").getPath("v3")

# one can see that the map attribute of the returned object cannot reach v3,why though?
new DeltaSteppingShortestPath<>(graph).getPaths("v0")

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)