mascoptLib.algos.digraph
Class KShortestPaths

java.lang.Object
  extended bymascoptLib.algos.digraph.KShortestPaths

public class KShortestPaths
extends Object


Field Summary
static String NAME_OF_VALUE
          The string used to get double values on arcs.
 
Constructor Summary
KShortestPaths(DiGraph g, int k)
          Constructor of KShortestPaths.
 
Method Summary
 DiPath getShortestPath(int k)
          Return the k-th path computed.
 double getWeight(int k)
          Returns the weight of the k-th path.
 int numberOfComputedPaths()
          Return the number of computed paths.
 void printComputedPaths()
          Prints all the computed paths.
 void run(Vertex s, Vertex t)
          Runs the computation of k shortests paths between s and t.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_OF_VALUE

public static String NAME_OF_VALUE
The string used to get double values on arcs.

Constructor Detail

KShortestPaths

public KShortestPaths(DiGraph g,
                      int k)
Constructor of KShortestPaths.

Parameters:
g - the graph to use to find paths.
k - the number of paths to find.
Method Detail

run

public void run(Vertex s,
                Vertex t)
Runs the computation of k shortests paths between s and t.


getShortestPath

public DiPath getShortestPath(int k)
Return the k-th path computed. Start at k=0 (the first path). If there is no k-th path, it returns null.

Parameters:
k - the number of the path (start at 0).
Returns:
the k-th path.

numberOfComputedPaths

public int numberOfComputedPaths()
Return the number of computed paths.

Returns:
the number of computed paths.

printComputedPaths

public void printComputedPaths()
Prints all the computed paths.


getWeight

public double getWeight(int k)
Returns the weight of the k-th path. Starts at k=0.

Returns:
Returns the weight of k-th path.