Package net.automatalib.util.graph.apsp
Class FloydWarshallAPSP<N,E>
- java.lang.Object
-
- net.automatalib.util.graph.apsp.FloydWarshallAPSP<N,E>
-
- Type Parameters:
N
- node classE
- edge class
- All Implemented Interfaces:
APSPResult<N,E>
public class FloydWarshallAPSP<N,E> extends Object implements APSPResult<N,E>
Implementation of the Floyd-Warshall dynamic programming algorithm for the all pairs shortest paths problem.
-
-
Constructor Summary
Constructors Constructor Description FloydWarshallAPSP(Graph<N,E> graph, EdgeWeights<E> ew)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
findAPSP()
static <N,E>
APSPResult<N,E>findAPSP(Graph<N,E> graph, EdgeWeights<E> edgeWeights)
@Nullable List<E>
getShortestPath(N src, N tgt)
Retrieves the shortest path between the given nodes, ornull
if there exists no such path.float
getShortestPathDistance(N src, N tgt)
Retrieves the length of the shortest path between the given nodes.
-
-
-
Constructor Detail
-
FloydWarshallAPSP
public FloydWarshallAPSP(Graph<N,E> graph, EdgeWeights<E> ew)
-
-
Method Detail
-
findAPSP
public static <N,E> APSPResult<N,E> findAPSP(Graph<N,E> graph, EdgeWeights<E> edgeWeights)
-
findAPSP
public void findAPSP()
-
getShortestPathDistance
public float getShortestPathDistance(N src, N tgt)
Description copied from interface:APSPResult
Retrieves the length of the shortest path between the given nodes.- Specified by:
getShortestPathDistance
in interfaceAPSPResult<N,E>
- Parameters:
src
- the source nodetgt
- the target node- Returns:
- the length of the shortest path from
src
totgt
, orGraphs.INVALID_DISTANCE
if there exists no such path.
-
getShortestPath
public @Nullable List<E> getShortestPath(N src, N tgt)
Description copied from interface:APSPResult
Retrieves the shortest path between the given nodes, ornull
if there exists no such path.- Specified by:
getShortestPath
in interfaceAPSPResult<N,E>
- Parameters:
src
- the source nodetgt
- the target node- Returns:
- the shortest path from
src
totgt
, ornull
if there exists no such path.
-
-