Class ShortestPathResultImpl

  • All Implemented Interfaces:
    ShortestPathResult

    public class ShortestPathResultImpl
    extends Object
    implements ShortestPathResult
    Class that stores the result of a shortest path execution allowing one to extract paths or cost information Note that we must traverse a path from an origin to a destination in reversed order to extract the path
    Author:
    markr
    • Field Detail

      • vertexMeasuredCost

        protected final double[] vertexMeasuredCost
        the costs found by a shortest path run
      • incomingEdgeSegment

        protected final EdgeSegment[] incomingEdgeSegment
        the preceding vertex to reach the vertex with the given measured cost
    • Constructor Detail

      • ShortestPathResultImpl

        protected ShortestPathResultImpl​(double[] vertexMeasuredCost,
                                         EdgeSegment[] incomingEdgeSegment)
        Constructor only to be used by shortest path algorithms
        Parameters:
        vertexMeasuredCost - measured costs to get to the vertex (by id)
        incomingEdgeSegment - the incoming edge segment for each vertex (by id)
    • Method Detail

      • createPath

        public DirectedPath createPath​(DirectedPathFactory pathFactory,
                                       Vertex origin,
                                       Vertex destination)
        Create the path from the provided origin to a specified destination vertex, using the results available. The path builder is used to create the instance of the path.
        Specified by:
        createPath in interface ShortestPathResult
        Parameters:
        pathFactory - to use for creating path instances
        origin - the specified origin vertex
        destination - the specified destination vertex
        Returns:
        the path that is created, when no path could be extracted null is returned
      • getCostToReach

        public double getCostToReach​(Vertex vertex)
        Collect the cost to reach the given vertex
        Specified by:
        getCostToReach in interface ShortestPathResult
        Parameters:
        vertex - to collect cost for
        Returns:
        cost found