mascoptDev.algos.digraph
Class LongestPathDAGCost
java.lang.Object
|
+--mascoptDev.algos.digraph.LongestPathDAG
|
+--mascoptDev.algos.digraph.LongestPathDAGCost
- public class LongestPathDAGCost
- extends LongestPathDAG
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 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.
LongestPathDAGCost
public LongestPathDAGCost(DiGraph g,
VertexSet w,
Arc r,
Vector c)
- Constructor.
- Parameters:
w
- VertexSet
representing the vertex which belong to the DAG.r
- Arc
representing the source and the destination of the longest path.c
- Vector
representing thes cost on each cable, the index correspond to the String value INDEX on arc.
LongestPathDAGCost
public LongestPathDAGCost(DiGraph g,
VertexSet w,
Vector c)
- Constructor.
- Parameters:
w
- VertexSet
representing the vertex which belong to the DAG.c
- Vector
representing thes cost on each cable, the index correspond to the String value INDEX on arc.
getCost
public Double getCost(Arc a)
- Overrides:
getCost
in class LongestPathDAG
setAllCost
public void setAllCost(Vector c)