Package org.goplanit.algorithms.shortest
Class ShortestPathSearchUtils
- java.lang.Object
-
- org.goplanit.algorithms.shortest.ShortestPathSearchUtils
-
public final class ShortestPathSearchUtils extends Object
Some common utilities for various shortest path algorithms. The lambdas provided base their direction (up/downstream) on the direction used in the shortest path search NOT the results it yields. To traverse the results, the opposite direciton is required which can be obtained by inverting the call via a flag.- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description ShortestPathSearchUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Function<DirectedVertex,Iterable<? extends EdgeSegment>>
getEdgeSegmentsInDirectionLambda(ShortestSearchType shortestPathSearchType)
Based on the search type we collect edge segments (up or downstream) for a given vertex.static Function<DirectedVertex,Iterable<? extends EdgeSegment>>
getEdgeSegmentsInDirectionLambda(ShortestSearchType shortestPathSearchType, boolean invertDirection)
Based on the search type we collect edge segments (up or downstream) for a given vertex.static Function<DirectedVertex,Iterable<? extends EdgeSegment>>
getEdgeSegmentsInDirectionLambda(RootedLabelledBush bush)
Based on the bush configuration we collect different edge segments from vertex (entry or exit segments) compatible with a (shortest) path search.static Function<DirectedVertex,Iterable<? extends EdgeSegment>>
getEdgeSegmentsInDirectionLambda(RootedLabelledBush bush, boolean invertDirection)
Based on the bush configuration we collect different edge segments from vertex (entry or exit segments) compatible with a (shortest) path search.static Function<EdgeSegment,DirectedVertex>
getVertexFromEdgeSegmentLambda(ShortestSearchType shortestPathSearchType)
Identical togetVertexFromEdgeSegmentLambda(ShortestSearchType)
static Function<EdgeSegment,DirectedVertex>
getVertexFromEdgeSegmentLambda(ShortestSearchType shortestPathSearchType, boolean invertDirection)
Based on the search type we collect different vertex direction from edge segment (up or downstream) during shortest path search.static Function<EdgeSegment,DirectedVertex>
getVertexFromEdgeSegmentLambda(RootedLabelledBush bush)
Based on the bush configuration we collect different vertex direction from edge segment (up or downstream) compatible with a (shortest) path search.static Function<EdgeSegment,DirectedVertex>
getVertexFromEdgeSegmentLambda(RootedLabelledBush bush, boolean invertDirection)
Based on the bush configuration we collect different vertex direction from edge segment (up or downstream) compatible with a (shortest) path search.
-
-
-
Method Detail
-
getVertexFromEdgeSegmentLambda
public static Function<EdgeSegment,DirectedVertex> getVertexFromEdgeSegmentLambda(ShortestSearchType shortestPathSearchType)
Identical togetVertexFromEdgeSegmentLambda(ShortestSearchType)
- Parameters:
shortestPathSearchType
- to base lambda on- Returns:
- lambda collecting vertex based on given edge segment
-
getVertexFromEdgeSegmentLambda
public static Function<EdgeSegment,DirectedVertex> getVertexFromEdgeSegmentLambda(RootedLabelledBush bush, boolean invertDirection)
Based on the bush configuration we collect different vertex direction from edge segment (up or downstream) compatible with a (shortest) path search. In case the bush is not inverted, i.e., runs from single origin to one or more destinations we collect the downstream vertex, otherwise the upstream vertex. This direction can be swapped if desired with the invertDirection parameter- Parameters:
bush
- based on the configuration of the bush determine which vertex to collect.invertDirection
- flag to invert direction compared to "regular" result- Returns:
- lambda collecting vertex based on given edge segment
-
getVertexFromEdgeSegmentLambda
public static Function<EdgeSegment,DirectedVertex> getVertexFromEdgeSegmentLambda(RootedLabelledBush bush)
Based on the bush configuration we collect different vertex direction from edge segment (up or downstream) compatible with a (shortest) path search. In case the bush is not inverted, i.e., runs from single origin to one or more destinations we collect the downstream vertex, otherwise the upstream vertex.- Parameters:
bush
- based on the configuration of the bush determine which vertex to collect.- Returns:
- lambda collecting vertex based on given edge segment
-
getVertexFromEdgeSegmentLambda
public static Function<EdgeSegment,DirectedVertex> getVertexFromEdgeSegmentLambda(ShortestSearchType shortestPathSearchType, boolean invertDirection)
Based on the search type we collect different vertex direction from edge segment (up or downstream) during shortest path search. This method provides the Lambda that performs this collection.- Parameters:
shortestPathSearchType
- to base lambda oninvertDirection
- flag to invert direction compared to "regular" result- Returns:
- lambda collecting vertex based on given edge segment
-
getEdgeSegmentsInDirectionLambda
public static Function<DirectedVertex,Iterable<? extends EdgeSegment>> getEdgeSegmentsInDirectionLambda(RootedLabelledBush bush, boolean invertDirection)
Based on the bush configuration we collect different edge segments from vertex (entry or exit segments) compatible with a (shortest) path search. In case the bush is not inverted, i.e., runs from single origin to one or more destinations we collect the downstream edge segments, otherwise the upstream edge segments. This direction can be swapped if desired with the invertDirection parameter- Parameters:
bush
- to base lambda oninvertDirection
- flag to invert direction compared to "regular" result- Returns:
- lambda collecting edge segments in given direction based on vertex provided
-
getEdgeSegmentsInDirectionLambda
public static Function<DirectedVertex,Iterable<? extends EdgeSegment>> getEdgeSegmentsInDirectionLambda(RootedLabelledBush bush)
Based on the bush configuration we collect different edge segments from vertex (entry or exit segments) compatible with a (shortest) path search. i.e., runs from single origin to one or more destinations we collect the downstream edge segments, otherwise the upstream edge segments.- Parameters:
bush
- to base lambda on- Returns:
- lambda collecting edge segments in given direction based on vertex provided
-
getEdgeSegmentsInDirectionLambda
public static Function<DirectedVertex,Iterable<? extends EdgeSegment>> getEdgeSegmentsInDirectionLambda(ShortestSearchType shortestPathSearchType)
Based on the search type we collect edge segments (up or downstream) for a given vertex. This method provides the Lambda that performs this collection.- Parameters:
shortestPathSearchType
- to base lambda on- Returns:
- lambda collecting edge segments in given direction based on vertex provided
-
getEdgeSegmentsInDirectionLambda
public static Function<DirectedVertex,Iterable<? extends EdgeSegment>> getEdgeSegmentsInDirectionLambda(ShortestSearchType shortestPathSearchType, boolean invertDirection)
Based on the search type we collect edge segments (up or downstream) for a given vertex. This method provides the Lambda that performs this collection.- Parameters:
shortestPathSearchType
- to base lambda oninvertDirection
- flag to invert direction compared to "regular" result- Returns:
- lambda collecting edge segments in given direction based on vertex provided
-
-