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 voidfindAPSP()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, ornullif there exists no such path.floatgetShortestPathDistance(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:APSPResultRetrieves the length of the shortest path between the given nodes.- Specified by:
getShortestPathDistancein interfaceAPSPResult<N,E>- Parameters:
src- the source nodetgt- the target node- Returns:
- the length of the shortest path from
srctotgt, orGraphs.INVALID_DISTANCEif there exists no such path.
-
getShortestPath
public @Nullable List<E> getShortestPath(N src, N tgt)
Description copied from interface:APSPResultRetrieves the shortest path between the given nodes, ornullif there exists no such path.- Specified by:
getShortestPathin interfaceAPSPResult<N,E>- Parameters:
src- the source nodetgt- the target node- Returns:
- the shortest path from
srctotgt, ornullif there exists no such path.
-
-