|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--mascoptDev.algos.digraph.Bellman
Provides algorithm of Bellman Ford 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.
Field Summary | |
String |
CAPACITY_STRING_VALUE
String which is read on edges for the capacity. |
String |
COST_BELLMAN
String which identify the value to consider as the distance on arc. |
static String |
FATHER
String which identify the value to consider the father of the destination on arc . |
static String |
FATHER_LEVEL
String which identify the value to consider the level of father on vertex. |
double |
INFINITY
String which is infinity. |
Constructor Summary | |
Bellman(DiGraph g)
Constructor. |
|
Bellman(DiGraph g,
String cost)
Constructor. |
|
Bellman(DiGraph g,
Vertex s)
Constructor. |
|
Bellman(DiGraph g,
Vertex s,
String cost)
Constructor. |
Method Summary | |
DiPath |
getChain(Vertex dest)
Returns the chain from source to the vertex dest. |
Double |
getCost(Arc a)
|
Vertex |
getSource()
Return the source of shortest path. |
void |
run()
Computes the shortest distances from vertex source to all other vertex of graph. |
void |
setSource(Vertex s)
Set the source of shortest path. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public String COST_BELLMAN
public static String FATHER
public static String FATHER_LEVEL
public String CAPACITY_STRING_VALUE
public double INFINITY
Constructor Detail |
public Bellman(DiGraph g, Vertex s)
s
- Vertex
representing the
source of chains.public Bellman(DiGraph g)
public Bellman(DiGraph g, String cost)
cost
- String
representing the string value
of the cost.public Bellman(DiGraph g, Vertex s, String cost)
s
- Vertex
representing the
source of chains.cost
- String
representing the string value
of the cost.Method Detail |
public Vertex getSource()
public void setSource(Vertex s)
public Double getCost(Arc a)
public void run()
public DiPath getChain(Vertex dest)
dest
- Vertex
representing the
destination of chain.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |