public static class AStar.DefaultCosts extends Object implements AStar.Costs
Number
an must be translatable to a double value. This implementation
always return 0 for the H value. This makes the A* algorithm an
equivalent of the Dijkstra algorithm.Modifier and Type | Field and Description |
---|---|
protected String |
weightAttribute
The attribute used to retrieve the cost of an edge cross.
|
Constructor and Description |
---|
DefaultCosts()
New default costs for the A* algorithm.
|
DefaultCosts(String weightAttributeName)
New default costs for the A* algorithm.
|
Modifier and Type | Method and Description |
---|---|
double |
cost(Node parent,
Edge edge,
Node next)
The cost of moving from parent to next.
|
double |
heuristic(Node node,
Node target)
The heuristic.
|
protected String weightAttribute
public DefaultCosts()
public DefaultCosts(String weightAttributeName)
weightAttributeName
- The name of cost attributes on edges.public double heuristic(Node node, Node target)
heuristic
in interface AStar.Costs
node
- A node.target
- The target node.public double cost(Node parent, Edge edge, Node next)
cost
in interface AStar.Costs
parent
- The node we come from.edge
- The edge between parent and next.next
- The node we go to.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses