Class AStar
This class implements the algorithm for an a*-search algorithm
Inheritance
System.Object
AStar
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Mars.Common.Collections.Graph.Algorithms
Assembly: Mars.Common.dll
Syntax
public static class AStar
Methods
| Improve this Doc View SourceAStarAlgorithm(SpatialGraph, Int32, Int32, Func<EdgeData, NodeData, Double>)
Search for a best sequence of EdgeData associations between
nodes on the given , starting from node
ending at node with key . An delegate can be passed to select the next
NodeData to expand for search.
Declaration
public static IList<EdgeData> AStarAlgorithm(this SpatialGraph graph, int start, int goal, Func<EdgeData, NodeData, double> heuristic = null)
Parameters
Type | Name | Description |
---|---|---|
SpatialGraph | graph | The graph on which to apply the search. |
System.Int32 | start | The node to start the search. |
System.Int32 | goal | The goal to end the search. |
System.Func<EdgeData, NodeData, System.Double> | heuristic | An optional heuristic to use. Default Mars.Common.Collections.Graph.Algorithms.AStar.ShortestPathHeuristic |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<EdgeData> |
Returns a new list of EdgeData as the most cost-efficient
sequence to reach the |
AStarNextNodeIndices(SpatialGraph, Int32, Int32, Func<EdgeData, NodeData, Double>)
This class implements the algorithm for an a*-search algorithm
Declaration
public static IList<int> AStarNextNodeIndices(this SpatialGraph graph, int start, int goal, Func<EdgeData, NodeData, double> heuristic)
Parameters
Type | Name | Description |
---|---|---|
SpatialGraph | graph | |
System.Int32 | start | |
System.Int32 | goal | |
System.Func<EdgeData, NodeData, System.Double> | heuristic |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<System.Int32> |
AStarPathAlgorithm(SpatialGraph, Int32, Int32, Func<EdgeData, NodeData, Double>)
This class implements the algorithm for an a*-search algorithm
Declaration
public static IDictionary<int, int> AStarPathAlgorithm(this SpatialGraph graph, int start, int goal, Func<EdgeData, NodeData, double> heuristic)
Parameters
Type | Name | Description |
---|---|---|
SpatialGraph | graph | |
System.Int32 | start | |
System.Int32 | goal | |
System.Func<EdgeData, NodeData, System.Double> | heuristic |
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.Int32, System.Int32> |