QuickGraph - 排名最短的路径 - 缺少路径

时间:2012-11-28 17:34:20

标签: c# shortest-path quickgraph

因为我在QuickGraph中找不到HoffmanPavleyRankedShortestPathAlgorithm的太多文档,所以我在这里做了一个很长的镜头,所以我猜不是很多人都使用它,但我有一些问题返回使用排名最短路径算法得到正确的结果,并想知道是否有人发现了同样的问题。

我正在填充带有1900个顶点和20000个边缘的双向图,我已将图形设置为返回150个路径。它做到了这一点,但它没有带回预期的几条路径,即应该排在前20条最短路径的路径。我对系统的期望是,如果我要求150条路径,它将按顺序返回150条最短路径。

现在,当我将其设置为返回超过1000个路径时,会显示预期的路径。有没有人遇到过这样的问题,可能有办法改进图形设置?我不能让系统返回1000个路径,因为处理时间太长。

以下是相关代码: 图表设置:

BidirectionalGraph<string, TaggedEdge<string, int>> pathGraph = new BidirectionalGraph<string, TaggedEdge<string, int>>();

... add vertices and edges

算法设置:

HoffmanPavleyRankedShortestPathAlgorithm<string, TaggedEdge<string, int>> hoffmanAlgorithm = new HoffmanPavleyRankedShortestPathAlgorithm<string, TaggedEdge<string, int>>(pathGraph, E => 1.0);
try
{
    hoffmanAlgorithm.ShortestPathCount = 150;
    hoffmanAlgorithm.SetRootVertex(startPoint.ToString());
    hoffmanAlgorithm.Compute(startPoint.ToString(), endPoint.ToString());

    foreach (IEnumerable<TaggedEdge<string, int>> path in hoffmanAlgorithm.ComputedShortestPaths)
    {
         //process results...
    }
}

正如我所说的那样,我并没有过于自信在这里得到回应,但我想我还是会尝试。关于CodePlex的QuickGraph讨论论坛似乎不再有人了 或者我会尝试那里。

非常感谢

0 个答案:

没有答案