aStar
aStar<
TNode>(start,traits):GraphPath<TNode> |null
Defined in: graph/a-star.ts:24
Finds the cheapest path from start to a goal, exploring by cost so far plus
estimated cost remaining.
With no heuristicOf this is Dijkstra’s algorithm — the estimate is
uniformly zero, so exploration is purely by cost so far. A heuristic that
never overestimates keeps the result optimal while cutting how much of the
graph gets visited; one that overestimates trades that guarantee for speed.
Time complexity: O((V + E) log V), and costOf must be non-negative.
Type Parameters
Section titled “Type Parameters”TNode extends DefinedValue
Parameters
Section titled “Parameters”TNode
The node to search from.
traits
Section titled “traits”GraphSearchTraits<TNode>
How to expand, weight and test a node.
Returns
Section titled “Returns”GraphPath<TNode> | null
The cheapest path and its cost, or null if no goal is reachable.