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 theManyToManyShortestPathsAlgorithm.ManyToManyShortestPaths. For each pair of source and target vertices stores a corresponding path between them.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GraphPath<V,E>getPath(V source, V target)Return the path from thesourcevertex to thetargetvertex.doublegetWeight(V source, V target)Return the weight of the path from thesourcevertex to thetargetvertex orDouble.POSITIVE_INFINITYif there is no such path in the graph.-
Methods inherited from class org.jgrapht.alg.interfaces.ManyToManyShortestPathsAlgorithm.BaseManyToManyShortestPathsImpl
assertCorrectSourceAndTarget, getSources, getTargets
-
-
-
-
Constructor Detail
-
DefaultManyToManyShortestPathsImpl
DefaultManyToManyShortestPathsImpl(java.util.Set<V> sources, java.util.Set<V> targets, java.util.Map<V,java.util.Map<V,GraphPath<V,E>>> pathsMap)
Constructs an instance of the algorithm for the givensources,targetsandpathsMap.- Parameters:
sources- source verticestargets- target verticespathsMap- map with paths between sources and targets
-
-
Method Detail
-
getPath
public GraphPath<V,E> getPath(V source, V target)
Return the path from thesourcevertex to thetargetvertex. If no such path exists, null is returned.- Parameters:
source- source vertextarget- target vertex- Returns:
- path between
sourceandtargetor null if no such path exists
-
getWeight
public double getWeight(V source, V target)
Return the weight of the path from thesourcevertex to thetargetvertex orDouble.POSITIVE_INFINITYif 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_INFINITYin case no such path exists
-
-