OdinAI
|
Given a graph, and an optional target, it calculates the shortest path from the source node to the target. More...
#include <DijkstraGraphSearch.h>
Public Member Functions | |
DijkstraGraphSearch (const GraphType &graph, int source, int target=-1) | |
std::vector< const Edge * > | GetSPT () const |
std::list< int > | GetPath () const |
int | GetCostToTarget () const |
int | GetCostToNode (unsigned int nd) const |
Given a graph, and an optional target, it calculates the shortest path from the source node to the target.
The target maybe anything, it maybe a node, or it maybe a condition. Set target condition to your own class with a static function bool IsTarget, where the first argument should be a const graph reference, and the second an int, for the current node id. Below is an example:
|
inline |
Get cost to any node. NOTE it will only work if the node is on the SPT tree.
|
inline |
Get cost to our target.
std::list< int > OdinAI::DijkstraGraphSearch< GraphType, TargetCondition >::GetPath | ( | ) | const |
Get the path. The list is empty if no path found.
|
inline |
Get our shortest path tree, in other words the shortest path from any node to any node.