public static class AStar.DefaultCosts extends java.lang.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.| Constructor and Description |
|---|
DefaultCosts()
New default costs for the A* algorithm.
|
DefaultCosts(java.lang.String weightAttributeName)
New default costs for the A* algorithm.
|
| Modifier and Type | Method and Description |
|---|---|
double |
cost(org.graphstream.graph.Node parent,
org.graphstream.graph.Edge edge,
org.graphstream.graph.Node next)
The cost of moving from parent to next.
|
double |
heuristic(org.graphstream.graph.Node node,
org.graphstream.graph.Node target)
The heuristic.
|
public DefaultCosts()
public DefaultCosts(java.lang.String weightAttributeName)
weightAttributeName - The name of cost attributes on edges.public double heuristic(org.graphstream.graph.Node node,
org.graphstream.graph.Node target)
heuristic in interface AStar.Costsnode - A node.target - The target node.public double cost(org.graphstream.graph.Node parent,
org.graphstream.graph.Edge edge,
org.graphstream.graph.Node next)
cost in interface AStar.Costsparent - The node we come from.edge - The edge between parent and next.next - The node we go to.