e-o*_*-on 7 c# shortest-path quickgraph
这里有点远,因为我没有HoffmanPavleyRankedShortestPathAlgorithm在QuickGraph中找到太多的文档 ,所以我猜不是很多人都使用它,但是我有一些问题用Ranked Shortest Path返回正确的结果算法并且想知道是否有人发现了同样的问题.
我正在填充具有1900个顶点和20000个边缘的双向图形,并且我将图形设置为返回150个路径.它做到了这一点,但它没有带回预期的几条路径,即应该排在前20条最短路径的路径.我对系统的期望是,如果我要求150条路径,它将按顺序返回150条最短路径.
现在,当我将其设置为返回超过1000个路径时,则显示预期路径.有没有人遇到过这样的问题,可能有办法改进图形设置?我不能让系统返回1000个路径,因为处理时间太长.
以下是相关代码:图形设置:
BidirectionalGraph<string, TaggedEdge<string, int>> pathGraph = new BidirectionalGraph<string, TaggedEdge<string, int>>();
... add vertices and edges
Run Code Online (Sandbox Code Playgroud)
算法设置:
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...
}
}
Run Code Online (Sandbox Code Playgroud)
正如我所说的那样,我对这里得到回应并不过分有信心,但我想我还是会尝试的.关于CodePlex的QuickGraph讨论论坛似乎不再有人,或者我会在那里尝试.
非常感谢
| 归档时间: |
|
| 查看次数: |
1103 次 |
| 最近记录: |