BestPathfinder<E> mixin
Pathfinding
Visits a WeightedWalkable's nodes, finding a best path to a goal node.
Every algorithm that provides generalizable weighted path finding
capabilities can implement this interface to provide a consistent API for
finding paths between nodes in a weighted graph-like structure (e.g., a
graph, tree, or grid, or any WeightedWalkable implementation), or mix-in
(with BestPathfinder
) to derive some default implementations by
implementing only findBestPathExclusive.
Adapting an Unweighted Graph
It is possible to use a BestPathfinder with an unweighted graph by deriving a weight from an edge:
// 1.0 -> 3.0 -> 10.0
final unweighted = Walkable.linear([1.0, 3.0, 10.0]);
// The weight is the difference between the nodes.
final weighted = unweighted.asWeighted((a, b) => (b - a).abs());
- Implemented types
- Mixin Applications
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
-
findBestPath<
T extends E> (WeightedWalkable< T> graph, T start, Goal<T> goal, {Tracer<T> ? tracer}) → (Path<T> , double) -
Returns an optimal path (and it's total cost) in
graph
fromstart
to a node that satisfiesgoal
. -
findBestPathExclusive<
T extends E> (WeightedWalkable< T> graph, T start, Goal<T> goal, {Tracer<T> ? tracer}) → (Path<T> , double) -
Returns an optimal path (and it's total cost) in
graph
fromstart
to a node that satisfiesgoal
. -
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