Search code examples
c#shortest-patha-starquickgraph

Getting shortest path between 2 nodes in quickgraph


i want to ask if there is any way to generate the shortest path from node A to node B without generating the shortest paths to all the other nodes (stop when node B is in the examined set) with A-star in QuickGraph.

I want to plug QuickGraph into a game and thus generating all the paths is not allowed from the time limitations the environment imposes.

Any other suggestions to solve my problem in C# are welcome

Thanks in advance, Xtapodi


Solution

  • Quickgraph 3.3 has a built-in implementation of A* :

    QuickGraph.Algorithms.ShortestPath.AStarShortestPathAlgorithm<TVertex,TEdge>
    

    which version of quickgraph are you using ?