Interface SinglePairShortestPath

All Known Implementing Classes:
AStarAlgorithm, BFSSinglePairShortestPath, BidirectionalDijkstra

public interface SinglePairShortestPath
Contract for single-pair shortest path algorithms, that is finding a shortest path from s to t, for given vertices s and t.
Author:
Cristian Frăsinaru
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the shortest path between source and target.
    Returns the input graph on which the algorithm is executed.
    getInstance(Graph graph, int source, int target)
    Returns the default implementation of this interface.
    default double
    Returns the weight of the shortest path from the source to the target, or Double.POSITIVE_INFINITY if no path exists.
    int
    Returns the source vertex number.
    int
    Returns the target vertex number.
  • Method Details

    • getGraph

      Graph getGraph()
      Returns the input graph on which the algorithm is executed.
      Returns:
      the input graph.
    • findPath

      Path findPath()
      Returns the shortest path between source and target.
      Returns:
      the shortest path from the source to the target, or null if no path exists
    • getSource

      int getSource()
      Returns the source vertex number.
      Returns:
      the source vertex number.
    • getTarget

      int getTarget()
      Returns the target vertex number.
      Returns:
      the target vertex number.
    • getPathWeight

      default double getPathWeight()
      Returns the weight of the shortest path from the source to the target, or Double.POSITIVE_INFINITY if no path exists.
      Returns:
      the weight of the shortest path from the source to the target, or Double.POSITIVE_INFINITY if no path exists.
    • getInstance

      static SinglePairShortestPath getInstance(Graph graph, int source, int target)
      Returns the default implementation of this interface.
      Parameters:
      graph - the input graph.
      source - the source vertex.
      target - the target vertex.
      Returns:
      the default implementation of this interface.