Package org.goplanit.algorithms.shortest
Interface ShortestPathResult
-
- All Superinterfaces:
ShortestResult
- All Known Subinterfaces:
MinMaxPathResult
- All Known Implementing Classes:
MinMaxPathResultImpl
,ShortestPathResultGeneralised
public interface ShortestPathResult extends ShortestResult
Interfaces that defines how to access results of a shortest path execution allowing one to extract paths or cost information- Author:
- markr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T extends SimpleDirectedPath>
TcreatePath(DirectedPathFactory<T> pathFactory, DirectedVertex origin, DirectedVertex destination)
Create the path from the provided origin to a specified destination vertex, using the results available.default int
forEachNextEdgeSegment(DirectedVertex startVertex, DirectedVertex endVertex, Consumer<EdgeSegment> nextEdgeSegmentConsumer)
apply consumer to each edge segment on path.EdgeSegment
getNextEdgeSegmentForVertex(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-
Methods inherited from interface org.goplanit.algorithms.shortest.ShortestResult
getCostOf, getNextVertexForEdgeSegment, getSearchType, isInverted
-
-
-
-
Method Detail
-
createPath
<T extends SimpleDirectedPath> T createPath(DirectedPathFactory<T> pathFactory, DirectedVertex origin, DirectedVertex 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.- Type Parameters:
T
- type of path- Parameters:
pathFactory
- to use for creating path instancesorigin
- the specified origin vertexdestination
- the specified destination vertex- Returns:
- the path that is created, when no path could be extracted null is returned
-
getNextEdgeSegmentForVertex
EdgeSegment getNextEdgeSegmentForVertex(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- Parameters:
vertex
- to get next segment for- Returns:
- next edge segment
-
forEachNextEdgeSegment
default int forEachNextEdgeSegment(DirectedVertex startVertex, DirectedVertex endVertex, Consumer<EdgeSegment> nextEdgeSegmentConsumer)
apply consumer to each edge segment on path. Depending on the type of shortest path (direction), the next segment is either in the backward direction from destination to origin (one-to-all) or in the forward direction from the origin to the destination (all-to-one). This depends on the implementation of thegetNextEdgeSegmentForVertex(Vertex)
. If path does not lead to origin/destination, the loop terminates when no more next edge segment is found anymore- Parameters:
startVertex
- to useendVertex
- to usenextEdgeSegmentConsumer
- to apply to each next segment on the path- Returns:
- number of edge segments traversed on the path
-
-