Module org.jgrapht.core
Package org.jgrapht.alg.shortestpath
Class DefaultManyToManyShortestPaths.DefaultManyToManyShortestPathsImpl<V,E>
java.lang.Object
org.jgrapht.alg.interfaces.ManyToManyShortestPathsAlgorithm.BaseManyToManyShortestPathsImpl<V,E>
org.jgrapht.alg.shortestpath.DefaultManyToManyShortestPaths.DefaultManyToManyShortestPathsImpl<V,E>
- All Implemented Interfaces:
ManyToManyShortestPathsAlgorithm.ManyToManyShortestPaths<V,
E>
- Enclosing class:
DefaultManyToManyShortestPaths<V,
E>
static class DefaultManyToManyShortestPaths.DefaultManyToManyShortestPathsImpl<V,E>
extends ManyToManyShortestPathsAlgorithm.BaseManyToManyShortestPathsImpl<V,E>
Implementation of the
ManyToManyShortestPathsAlgorithm.ManyToManyShortestPaths
.
For each pair of source and target vertices stores a corresponding path between them.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the path from thesource
vertex to thetarget
vertex.double
Return the weight of the path from thesource
vertex to thetarget
vertex orDouble.POSITIVE_INFINITY
if there is no such path in the graph.Methods inherited from class org.jgrapht.alg.interfaces.ManyToManyShortestPathsAlgorithm.BaseManyToManyShortestPathsImpl
assertCorrectSourceAndTarget, getSources, getTargets
-
Field Details
-
pathsMap
Map with paths between sources and targets.
-
-
Constructor Details
-
DefaultManyToManyShortestPathsImpl
DefaultManyToManyShortestPathsImpl(Set<V> sources, Set<V> targets, Map<V, Map<V, GraphPath<V, E>>> pathsMap) Constructs an instance of the algorithm for the givensources
,targets
andpathsMap
.- Parameters:
sources
- source verticestargets
- target verticespathsMap
- map with paths between sources and targets
-
-
Method Details
-
getPath
Return the path from thesource
vertex to thetarget
vertex. If no such path exists, null is returned.- Parameters:
source
- source vertextarget
- target vertex- Returns:
- path between
source
andtarget
or null if no such path exists
-
getWeight
Return the weight of the path from thesource
vertex to thetarget
vertex orDouble.POSITIVE_INFINITY
if there is no such path in the graph. The weight of the path between a vertex and itself is always zero.- Parameters:
source
- source vertextarget
- target vertex- Returns:
- the weight of the path between source and sink vertices or
Double.POSITIVE_INFINITY
in case no such path exists
-