A-Star informed search algorithm. More...
#include <ogdf/graphalg/AStarSearch.h>
Public Member Functions | |
AStarSearch (const bool directed=false, const double maxGap=1, const EpsilonTest &et=EpsilonTest()) | |
Initializes a new A* search algorithm. | |
T | call (const Graph &graph, const EdgeArray< T > &cost, const node source, const node target, NodeArray< edge > &predecessor, std::function< T(node)> heuristic=[](node) { return T(0);}) |
Computes the shortests path between source and target . | |
Private Types | |
using | NodeQueue = PrioritizedMapQueue< node, T > |
Private Member Functions | |
void | investigateNode (const node v) |
Private Attributes | |
const EdgeArray< T > * | m_cost = nullptr |
bool | m_directed |
NodeArray< T > | m_distance |
EpsilonTest | m_et |
NodeArray< bool > | m_folded |
std::function< T(node)> | m_heuristic |
double | m_maxGap |
NodeArray< edge > * | m_predecessor = nullptr |
NodeQueue * | m_queue = nullptr |
A-Star informed search algorithm.
The algorithm is a generalization the the shortest path algorithm by Dijkstra. It was first described in "A Formal Basis for the Heuristic Determination of Minimum Cost Paths" by Hart, Nilsson and Raphael in 1968.
The algorithm yields an optimal solution to the single pair shortest pair problem. A heuristic for calculating a lower bound on the distance from any node to the target is optional. The algorithm can also be used to compute approximate solutions at a faster pace.
T | The type of edge cost |
Definition at line 54 of file AStarSearch.h.
|
private |
Definition at line 56 of file AStarSearch.h.
|
inlineexplicit |
Initializes a new A* search algorithm.
directed | Whether to traverse edges in both directions |
maxGap | The maximal gap between the computed path costs and the optimal solution. The default of 1 leads to an optimal solution. |
et | The ogdf::EpsilonTest to be used for comparing edge costs |
Definition at line 78 of file AStarSearch.h.
|
inline |
Computes the shortests path between source
and target
.
graph | The graph to investigate |
cost | The positive cost of each edge |
source | The start of the path to compute |
target | The end of the path to compute |
predecessor | Will contain the preceding edge of each node in the path predecessor [target] will be nullptr if no path could be found |
heuristic | The heuristic to be used. Note that the type ogdf::NodeArray is implicitly applicable here. The default heuristic will always return the trivial lower bound of zero. |
Definition at line 98 of file AStarSearch.h.
|
inlineprivate |
Definition at line 166 of file AStarSearch.h.
|
private |
Definition at line 63 of file AStarSearch.h.
|
private |
Definition at line 58 of file AStarSearch.h.
|
private |
Definition at line 66 of file AStarSearch.h.
|
private |
Definition at line 60 of file AStarSearch.h.
|
private |
Definition at line 62 of file AStarSearch.h.
|
private |
Definition at line 64 of file AStarSearch.h.
|
private |
Definition at line 59 of file AStarSearch.h.
|
private |
Definition at line 65 of file AStarSearch.h.
|
private |
Definition at line 67 of file AStarSearch.h.