|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.graphstream.algorithm.AStar.DefaultCosts
public static class AStar.DefaultCosts
An implementation of the Costs interface that provide a default heuristic. It computes the G part using "weights" on edges. These weights must be stored in an attribute on edges. By default this attribute must be named "weight", but this can be changed. The weight attribute must be a number an must be translatable to a float value. This implementation always return 0 for the H value. This makes the A* algorithm an equivalent of the Dijkstra algorithm.
Constructor Summary | |
---|---|
AStar.DefaultCosts()
New default costs for the A* algorithm. |
|
AStar.DefaultCosts(String weightAttributeName)
New default costs for the A* algorithm. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AStar.DefaultCosts()
public AStar.DefaultCosts(String weightAttributeName)
weightAttributeName
- The name of cost attributes on edges.Method Detail |
---|
public double heuristic(org.graphstream.graph.Node node, org.graphstream.graph.Node target)
heuristic
in interface AStar.Costs
node
- 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.Costs
parent
- The node we come from.edge
- The edge between parent and next.next
- The node we go to.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |