Class Greedy<T>
A graph solver which only considers the remaining estimated distance to the destination.
Inherited Members
Namespace: PathFinder.Solvers.Generic
Assembly: PathFinder.dll
Syntax
public sealed class Greedy<T> : SolverBase<T>, IGraphSolver<T>, IComparer<GraphNodeMetaData<T>> where T : IEquatable<T>
Type Parameters
Name | Description |
---|---|
T | The type of nodes to traverse. Must extend ITraversableNode<T> if traverser is null. |
Remarks
This solver is useful to determine if a path is possible, or in graphs where there are little to no obstructions or differences in cost to traverse between nodes.
Constructors
| Improve this Doc View SourceGreedy(T, T, INodeTraverser<T>)
Creates a solver using the Greedy method.
Declaration
public Greedy(T origin, T destination, INodeTraverser<T> traverser = null)
Parameters
Type | Name | Description |
---|---|---|
T | origin | |
T | destination | |
INodeTraverser<T> | traverser | Use the passed INodeTraverser<T> to traverse the graph. If no traverser if passed, T must extend ITraversableNode<T>. |
Methods
| Improve this Doc View SourceSolve(T, T, out IList<T>, INodeTraverser<T>, Int32)
Finds a path between the origin and destination node.
Declaration
public static SolverState Solve(T origin, T destination, out IList<T> path, INodeTraverser<T> traverser = null, int maxTicks = 1000000)
Parameters
Type | Name | Description |
---|---|---|
T | origin | |
T | destination | |
IList<T> | path | The resulting path if Success, otherwise |
INodeTraverser<T> | traverser | The INodeTraverser<T> implementation to use when traversing the graph -or-
|
System.Int32 | maxTicks | The maximum number of ticks to run before failing. |
Returns
Type | Description |
---|---|
SolverState | The SolverState of the solver after running. |