|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectmascoptLib.algos.abstractalgos.StepAlgo
mascoptLib.algos.abstractalgos.Dijkstra
Provides a simple algorithm to find distance from a node and the paths corresponding to this node.
After constructing the dijkstra object, two steps are necessary to obtains
shortest paths or distances. Choose a node from where you want to compute
distances and launch valuateFromSource
. Then, you can access
the values via other access methods.
Note that DISTANCE_MAX
is a constant representing the maximum
distance beetween two nodes (modelize the infinite value). It can be a
serious limitation for the use of algorithm.
The distance on edges are read with getValue with the parameter DIJKSTRADISTANCE. You can change this string to another string to read another value.
Note that all values on edges must be stored as string.
valuateFromSource
Field Summary | |
String |
DIJKSTRADISTANCE
The string which identify the value to consider as the distance on edges. |
Constructor Summary | |
Dijkstra(AbstractGraph g)
Default constructor. |
Method Summary | |
Hashtable |
getDistances()
Returns the hashtable giving distances. |
int |
getDistanceTo(AbstractVertex v)
Returns the distance from source of a node. |
AbstractPath |
getShortestPathTo(AbstractVertex v)
Returns the chain form source to node v. |
AbstractVertex |
getStartNode()
Returns the current starting node. |
void |
run()
Computes the shortest distances and paths from vertex u. |
void |
slowAlgorithm(boolean slow)
|
void |
valuateFromSource(AbstractVertex u)
Computes the shortest distances and paths from node u. |
Methods inherited from class mascoptLib.algos.abstractalgos.StepAlgo |
byStep, ends, isDemo, isEnded, nextStep, setTime, start, waitB |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public String DIJKSTRADISTANCE
Constructor Detail |
public Dijkstra(AbstractGraph g)
valuateFromSource
function to
compute the distances and path and then, get these results via other
access method of the class.
g
- the graph used by Dijkstra algorithmMethod Detail |
public void valuateFromSource(AbstractVertex u)
u
- the abstractnode source from where computing distancespublic void slowAlgorithm(boolean slow)
public void run()
run
in interface Runnable
run
in class StepAlgo
public Hashtable getDistances()
public int getDistanceTo(AbstractVertex v)
v
- the node wanted to know the distance.
public AbstractPath getShortestPathTo(AbstractVertex v)
v
- the node ending the shortest chain starting at source node.
public AbstractVertex getStartNode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |