- Type Parameters:
V- graph vertex typeE- graph edge type
- All Known Implementing Classes:
AStarSpurEngine,DijkstraSpurEngine
public interface SpurShortestPathEngine<V,E>
Abstract subroutine for the spur shortest-path computations performed by
BoundedPrunedYenKShortestPath.
Implementations must return an exact non-negative-weight shortest path from source to
sink on the input graph after temporarily removing the supplied
bannedVertices and bannedEdges. Implementations may use the optional
reverseDistancesToSink hint (computed once on the original graph by the caller) for
admissible heuristic / pruning purposes.
This is a pluggable abstraction so that different shortest-path back-ends can be benchmarked inside the same Yen variant: classical Dijkstra and A* with reverse-distance heuristic. The engine API is intentionally narrow so swapping engines does not change Yen-level behaviour.
-
Method Summary
Modifier and TypeMethodDescriptionlongNumber of vertices the engine has expanded (popped from its open set) since the lastresetCounters()call.findPath(Graph<V, E> graph, V source, V sink, Set<V> bannedVertices, Set<E> bannedEdges, Map<V, Double> reverseDistancesToSink) Compute an exact shortest path fromsourcetosinkongraphignoring vertices inbannedVerticesand edges inbannedEdges.name()Symbolic name of the engine, used in benchmark reports.longNumber of shortest-path queries answered since the lastresetCounters()call.voidReset internal counters.
-
Method Details
-
findPath
GraphPath<V,E> findPath(Graph<V, E> graph, V source, V sink, Set<V> bannedVertices, Set<E> bannedEdges, Map<V, Double> reverseDistancesToSink) Compute an exact shortest path fromsourcetosinkongraphignoring vertices inbannedVerticesand edges inbannedEdges.- Parameters:
graph- original graph (engines should not mutate it)source- source vertex of the spur querysink- target vertex of the spur querybannedVertices- vertices to ignore (must not includesourceorsink)bannedEdges- edges to ignorereverseDistancesToSink- optional hint, lower-bound distances from each vertex tosinkcomputed on the original graph; may benullfor engines that do not need it- Returns:
- the shortest path or
nullif no path exists in the masked graph
-
expandedVertices
long expandedVertices()Number of vertices the engine has expanded (popped from its open set) since the lastresetCounters()call. Best-effort metric used by benchmarks; engines that do not track expansion (e.g. those delegating to a back-end without a public expansion counter) may return0.- Returns:
- number of vertices popped from the engine's open set since the last reset, or
0when not tracked
-
pathQueries
long pathQueries()Number of shortest-path queries answered since the lastresetCounters()call.- Returns:
- number of shortest-path queries answered since the last reset
-
resetCounters
void resetCounters()Reset internal counters. Called byBoundedPrunedYenKShortestPathbetween independent runs so that counters report per-run statistics. -
name
String name()Symbolic name of the engine, used in benchmark reports.- Returns:
- a short human-readable identifier for this engine
-