shortestPathAll method
Iterable<Path<V, num> >
shortestPathAll(
- V source,
- Predicate1<
V> targetPredicate, { - num edgeCost(
- V source,
- V target
- num costEstimate(
- V target
- StorageStrategy<
V> ? vertexStrategy,
Performs a search for the shortest paths between source
and the
targetPredicate
predicate.
-
edgeCost
is a function that returns the cost to traverse an edge between two vertices. If no function is provided, the numeric edge value or a constant weight of 1 is used. -
costEstimate
is a function that returns the remaining cost from the provided vertex. If an estimate is provided a faster A*-Search is performed, otherwise a Dijkstra Search.
Implementation
Iterable<Path<V, num>> shortestPathAll(
V source,
Predicate1<V> targetPredicate, {
num Function(V source, V target)? edgeCost,
num Function(V target)? costEstimate,
StorageStrategy<V>? vertexStrategy,
}) =>
costEstimate == null
? DijkstraSearchIterable<V>(
startVertices: [source],
targetPredicate: targetPredicate,
successorsOf: successorsOf,
edgeCost: edgeCost ?? _getDefaultEdgeValueOr(1),
vertexStrategy: vertexStrategy ?? this.vertexStrategy,
)
: AStarSearchIterable<V>(
startVertices: [source],
targetPredicate: targetPredicate,
successorsOf: successorsOf,
costEstimate: costEstimate,
edgeCost: edgeCost ?? _getDefaultEdgeValueOr(1),
vertexStrategy: vertexStrategy ?? this.vertexStrategy,
);