Class ShortestBushResultGeneralised

  • All Implemented Interfaces:
    ShortestBushResult, ShortestResult

    public class ShortestBushResultGeneralised
    extends ShortestResultGeneralised
    implements ShortestBushResult
    Class that stores the result of a shortest bush execution allowing one to extract bushes or cost information for a given origin-to-vertex Note that we construct the bush in reverse order from destination to the origin via all viable paths to construct the bush
    Author:
    markr
    • Field Detail

      • nextEdgeSegments

        protected final Object[] nextEdgeSegments
        the next edge segment(s) to reach the vertex with the given measured cost. If only a single edge segment is present, that is what is stored, otherwise it is a list of edge segments
      • numberOfEdgeSegments

        protected final int numberOfEdgeSegments
        number of edge segments in the parent network
    • Constructor Detail

      • ShortestBushResultGeneralised

        protected ShortestBushResultGeneralised​(double[] vertexMeasuredCost,
                                                Object[] nextEdgeSegmentsByVertex,
                                                int numberOfEdgeSegments,
                                                ShortestSearchType searchType)
        Constructor only to be used by shortest path algorithms
        Parameters:
        vertexMeasuredCost - measured costs to get to the vertex (by id)
        nextEdgeSegmentsByVertex - the found next edge segment for each vertex (by id)
        numberOfEdgeSegments - on the parent network
        searchType - used (one-to-all, all-to-one, etc)
    • Method Detail

      • createDirectedAcyclicSubGraph

        public ACyclicSubGraph createDirectedAcyclicSubGraph​(IdGroupingToken idToken,
                                                             DirectedVertex origin,
                                                             DirectedVertex destination)
        Create a bush in the form of a directed acyclic subgraph of its parent network (layer) for a given origin-destination vertex. The direction of the result is inherited from the search itself, so if the search was inverted, the dag has an inverted root etc.
        Specified by:
        createDirectedAcyclicSubGraph in interface ShortestBushResult
        Parameters:
        idToken - to use for the Acyclic subgraph's id generation
        origin - to use
        destination - to use
        Returns:
        created acyclic graph
      • getNextEdgeSegmentsForVertex

        public List<EdgeSegment> getNextEdgeSegmentsForVertex​(Vertex vertex)
        Find the next edge segment for a given vertex, depending on the underlying search this can be either in upstream or downstream direction
        Specified by:
        getNextEdgeSegmentsForVertex in interface ShortestBushResult
        Parameters:
        vertex - to get next segment for
        Returns:
        next edge segment
      • getCostOf

        public double getCostOf​(Vertex vertex)
        Collect the cost to reach the given vertex from the reference starting point
        Specified by:
        getCostOf in interface ShortestResult
        Parameters:
        vertex - to collect cost for
        Returns:
        cost found