V
 the graph vertex typeE
 the graph edge typepublic class FloydWarshallShortestPaths<V,E> extends Object
Constructor and Description 

FloydWarshallShortestPaths(Graph<V,E> graph)
Create a new instance of the FloydWarshall allpairs shortest path algorithm.

Modifier and Type  Method and Description 

double 
getDiameter() 
V 
getFirstHop(V a,
V b)
Returns the first hop, i.e., the second node on the shortest path from a to b.

Graph<V,E> 
getGraph() 
V 
getLastHop(V a,
V b)
Returns the last hop, i.e., the second to last node on the shortest path from a to b.

GraphPath<V,E> 
getShortestPath(V a,
V b)
Get the shortest path between two vertices.

List<V> 
getShortestPathAsVertexList(V a,
V b)
Get the shortest path between two vertices as a list of vertices.

List<GraphPath<V,E>> 
getShortestPaths()
Get all shortest paths in the graph.

List<GraphPath<V,E>> 
getShortestPaths(V v)
Get shortest paths from a vertex to all other vertices in the graph.

int 
getShortestPathsCount() 
double 
shortestDistance(V a,
V b)
Get the length of a shortest path.

public int getShortestPathsCount()
public double shortestDistance(V a, V b)
a
 first vertexb
 second vertexpublic double getDiameter()
public GraphPath<V,E> getShortestPath(V a, V b)
a
 from vertexb
 to vertexpublic List<V> getShortestPathAsVertexList(V a, V b)
a
 from vertexb
 to vertexpublic List<GraphPath<V,E>> getShortestPaths(V v)
v
 the originating vertexpublic List<GraphPath<V,E>> getShortestPaths()
public V getFirstHop(V a, V b)
a
 source vertexb
 target vertexpublic V getLastHop(V a, V b)
a
 source vertexb
 target vertexCopyright © 2016. All rights reserved.