GreedyBestFirstSearch<E> class final Pathfinding

Pathfinding algorithm that chooses the locally optimal path at each step.

Greedy best-first search 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 is closest to the goal, but does not guarantee that the path is the shortest.

Greedy best-first search is not guaranteed to find the shortest path, but it is faster than A* and Dijkstra's algorithm, as it does not consider the actual cost of reaching the goal from the current node.

A default singleton instance of this class is greedyBestFirstSearch.

Mixed in types

Constructors

GreedyBestFirstSearch()
Creates a new Greedy Best-First Search 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