edu.upc.dama.dex.algorithms
Class ShortestPath

java.lang.Object
  extended by edu.upc.dama.dex.tasks.Task
      extended by edu.upc.dama.dex.tasks.CompositeTask
          extended by edu.upc.dama.dex.algorithms.ShortestPath
All Implemented Interfaces:
Algorithm
Direct Known Subclasses:
SinglePairShortestPath

public abstract class ShortestPath
extends edu.upc.dama.dex.tasks.CompositeTask
implements Algorithm

Any class implementing this abstract class can be used to solve the single pair shortest path problem, single-source pair shortest path problem, single-destination shortest path problem or all-pairs shortest path problem.

Author:
Sparsity Technologies

Field Summary
 
Fields inherited from interface edu.upc.dama.dex.algorithms.Algorithm
NAVIGATION_BACKWARD, NAVIGATION_FORWARD, NAVIGATION_UNDIRECTED
 
Constructor Summary
ShortestPath(Graph graph)
          Creates a new instance of ShortestPath.
 
Method Summary
abstract  void close()
          Closes the instance.
abstract  void run()
          Runs the algorithm in order to solve the shortest path problem.
 void setMaximumHops(int maxhops)
          Sets the maximum hops restriction while traversing the graph in order to find the path, that is, the maximum depth of the graph traversal during the execution.
 
Methods inherited from class edu.upc.dama.dex.tasks.CompositeTask
cancel, execute, init
 
Methods inherited from class edu.upc.dama.dex.tasks.Task
main
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShortestPath

public ShortestPath(Graph graph)
Creates a new instance of ShortestPath.

Parameters:
graph - Graph on which the path will be found.
Method Detail

run

public abstract void run()
                  throws java.lang.Throwable
Runs the algorithm in order to solve the shortest path problem.

This method can be called only once.

Throws:
java.lang.Throwable

close

public abstract void close()
Closes the instance.

Once executed, the instance becomes invalid.


setMaximumHops

public void setMaximumHops(int maxhops)
Sets the maximum hops restriction while traversing the graph in order to find the path, that is, the maximum depth of the graph traversal during the execution.

It is possible to run the algorithm without specifying this parameter in order to avoid restricting the depth of the traversal.

Parameters:
maxhops - The number of hops allowed in the graph traversal while running this algorithm.