mascoptDev.algos.digraph
Class BellmanCost
java.lang.Object
|
+--mascoptDev.algos.digraph.Bellman
|
+--mascoptDev.algos.digraph.BellmanCost
- public class BellmanCost
- extends Bellman
Provides algorithm of Bellman to find distance from a node
and the paths corresponding to this node.
After constructing the Bellman object with a graph and the source,
two steps are necessary to obtain shortest paths or distances.
launch run and choose a destination where you want shortest chain,
then launch getChain(destination).
The cost vector is the cost for all arc in graph to calculate the shortest path.
The distance on vertex are read with getValue with the parameter COST_LONGEST_PATH.
You can change this string to another string to read another value.
Note that all values on edges must be stored as string.
BellmanCost
public BellmanCost(DiGraph g,
Vertex s,
Vector c)
BellmanCost
public BellmanCost(DiGraph g,
Vector c)
getCost
public Double getCost(Arc a)
- Overrides:
getCost
in class Bellman
setAllCost
public void setAllCost(Vector c)