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.


Field Summary
 
Fields inherited from class mascoptDev.algos.digraph.Bellman
CAPACITY_STRING_VALUE, COST_BELLMAN, FATHER, FATHER_LEVEL, INFINITY
 
Constructor Summary
BellmanCost(DiGraph g, Vector c)
           
BellmanCost(DiGraph g, Vertex s, Vector c)
           
 
Method Summary
 Double getCost(Arc a)
           
 void setAllCost(Vector c)
           
 
Methods inherited from class mascoptDev.algos.digraph.Bellman
getChain, getSource, run, setSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BellmanCost

public BellmanCost(DiGraph g,
                   Vertex s,
                   Vector c)

BellmanCost

public BellmanCost(DiGraph g,
                   Vector c)
Method Detail

getCost

public Double getCost(Arc a)
Overrides:
getCost in class Bellman

setAllCost

public void setAllCost(Vector c)