Tag: a star

如何在QuickGraph Dijkstra或A *中设置目标顶点

我正在使用QuickGraph版本3.6,我发现函数SetRootVertex,但没有SetTagretVertex。 我需要这个,因为我在巨大的图表中搜索短路径,这将加快程序的速度。 有问题的Clases是DijkstraShortestPathAlgorithm和AStarShortestPathAlgorithm。

A-star的曼哈顿启发函数(A *)

我在这里找到了这个算法。 我有一个问题,我似乎无法理解如何设置和传递我的启发式function。 static public Path AStar(TNode start, TNode destination, Func distance, Func estimate) where TNode : IHasNeighbours { var closed = new HashSet(); var queue = new PriorityQueue<double, Path>(); queue.Enqueue(0, new Path(start)); while (!queue.IsEmpty) { var path = queue.Dequeue(); if (closed.Contains(path.LastStep)) continue; if (path.LastStep.Equals(destination)) return path; closed.Add(path.LastStep); foreach (TNode n in path.LastStep.Neighbours) { double d […]