Interface ShortestPathAllPairs.IResult
- All Superinterfaces:
ShortestPathAllPairs.Result<Integer,Integer>
- Enclosing interface:
- ShortestPathAllPairs
ShortestPathAllPairs algorithm for IntGraph.- Author:
- Barak Ugav
-
Method Summary
Modifier and TypeMethodDescriptiondoubledistance(int source, int target) Get the distance of the shortest path between two vertices.default doubleDeprecated.getPath(int source, int target) Get the shortest path between vertices.default IPathDeprecated.Please usegetPath(int, int)instead to avoid un/boxing.booleanisReachable(int source, int target) Check if a target vertex is reachable from a source vertex.default booleanisReachable(Integer source, Integer target) Deprecated.Please useisReachable(int, int)instead to avoid un/boxing.reachableVerticesFrom(int source) Get the set of vertices that are reachable from a source vertex.default IntSetreachableVerticesFrom(Integer source) Deprecated.Please usereachableVerticesFrom(int)instead to avoid un/boxing.reachableVerticesTo(int target) Get the set of vertices that can reach a target vertex.default IntSetreachableVerticesTo(Integer target) Deprecated.Please usereachableVerticesTo(int)instead to avoid un/boxing.
-
Method Details
-
distance
double distance(int source, int target) Get the distance of the shortest path between two vertices.- Parameters:
source- the source vertextarget- the target vertex- Returns:
- the sum of weights of edges in the shortest path from the source to target,
or
Double.POSITIVE_INFINITYif no such path exists - Throws:
NoSuchVertexException- ifsourceortargetare not vertices in the graphIllegalArgumentException- if the shortest paths were computed on pairs of vertices from a subset of the vertices of the graph (rather than all pairs), andsourceortargetare not in the subset
-
distance
Deprecated.Please usedistance(int, int)instead to avoid un/boxing.Get the distance of the shortest path between two vertices.- Specified by:
distancein interfaceShortestPathAllPairs.Result<Integer,Integer> - Parameters:
source- the source vertextarget- the target vertex- Returns:
- the sum of weights of edges in the shortest path from the source to target,
or
Double.POSITIVE_INFINITYif no such path exists
-
getPath
Get the shortest path between vertices.- Parameters:
source- the source vertextarget- the target vertex- Returns:
- the shortest path from the source to target, or
nullif no such path exists - Throws:
NoSuchVertexException- ifsourceortargetare not vertices in the graphIllegalArgumentException- if the shortest paths were computed on pairs of vertices from a subset of the vertices of the graph (rather than all pairs), andsourceortargetare not in the subset
-
getPath
Deprecated.Please usegetPath(int, int)instead to avoid un/boxing.Get the shortest path between vertices.- Specified by:
getPathin interfaceShortestPathAllPairs.Result<Integer,Integer> - Parameters:
source- the source vertextarget- the target vertex- Returns:
- the shortest path from the source to target, or
nullif no such path exists
-
isReachable
boolean isReachable(int source, int target) Check if a target vertex is reachable from a source vertex.A vertex is reachable from itself.
- Parameters:
source- the source vertextarget- the target vertex- Returns:
trueif there is a path from the source to the target,falseotherwise- Throws:
NoSuchVertexException- ifsourceortargetare not vertices in the graph
-
isReachable
Deprecated.Please useisReachable(int, int)instead to avoid un/boxing.Check if a target vertex is reachable from a source vertex.A vertex is reachable from itself.
- Specified by:
isReachablein interfaceShortestPathAllPairs.Result<Integer,Integer> - Parameters:
source- the source vertextarget- the target vertex- Returns:
trueif there is a path from the source to the target,falseotherwise
-
reachableVerticesFrom
Get the set of vertices that are reachable from a source vertex.A vertex is reachable from itself.
If the result was obtained from a calculation on a subset of the vertices of the graph, this method may throw an exception, return only the vertices in the subset, or return all vertices reachable.
- Parameters:
source- the source vertex- Returns:
- the set of vertices that are reachable from the source vertex
- Throws:
NoSuchVertexException- ifsourceis not a vertex in the graph
-
reachableVerticesFrom
Deprecated.Please usereachableVerticesFrom(int)instead to avoid un/boxing.Get the set of vertices that are reachable from a source vertex.A vertex is reachable from itself.
If the result was obtained from a calculation on a subset of the vertices of the graph, this method may throw an exception, return only the vertices in the subset, or return all vertices reachable.
- Specified by:
reachableVerticesFromin interfaceShortestPathAllPairs.Result<Integer,Integer> - Parameters:
source- the source vertex- Returns:
- the set of vertices that are reachable from the source vertex
-
reachableVerticesTo
Get the set of vertices that can reach a target vertex.A vertex can reach itself.
If the result was obtained from a calculation on a subset of the vertices of the graph, this method may throw an exception, return only the vertices in the subset, or return all vertices reachable.
- Parameters:
target- the target vertex- Returns:
- the set of vertices that can reach the target vertex
- Throws:
NoSuchVertexException- iftargetis not a vertex in the graph
-
reachableVerticesTo
Deprecated.Please usereachableVerticesTo(int)instead to avoid un/boxing.Get the set of vertices that can reach a target vertex.A vertex can reach itself.
If the result was obtained from a calculation on a subset of the vertices of the graph, this method may throw an exception, return only the vertices in the subset, or return all vertices reachable.
- Specified by:
reachableVerticesToin interfaceShortestPathAllPairs.Result<Integer,Integer> - Parameters:
target- the target vertex- Returns:
- the set of vertices that can reach the target vertex
-
distance(int, int)instead to avoid un/boxing.