Astar<E> class final Pathfinding

Pathfinding algorithm that finds an optimal shortest path using a heuristic.

A* is an informed search algorithm that uses a Heuristic to estimate the cost to reach the goal from a given node. It always chooses the node that has the lowest total cost, which is the sum of the actual cost of reaching the node from the start and the estimated cost to reach the goal from the node.

A* is guaranteed to find the shortest path, but it is slower than greedy best-first search, as it considers the actual cost of reaching the goal from the current node.

A default singleton instance of this class is astar.

Mixed in types

Constructors

Astar()
Creates a new A* algorithm.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

asBestPathfinder<G extends Goal<E>>({required Heuristic<T> toNode<T extends E>(E), required Heuristic<T> orElse<T extends E>(E, G)}) BestPathfinder<E>
Adapts this HeuristicPathfinder to a BestPathfinder.
inherited
findBestPath<T extends E>(WeightedWalkable<T> graph, T start, Goal<T> goal, Heuristic<T> heuristic, {Tracer<T>? tracer}) → (Path<T>, double)
Returns an optimal path (and it's total cost) in graph from start to a node that satisfies goal.
inherited
findBestPathExclusive<T extends E>(WeightedWalkable<T> graph, T start, Goal<T> goal, Heuristic<T> heuristic, {Tracer<T>? tracer}) → (Path<T>, double)
Returns an optimal path (and it's total cost) in graph from start to a node that satisfies goal.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited