java.lang.Object
org.jgrapht.alg.shortestpath.GraphMeasurer<V,E>
 Type Parameters:
V
 the graph vertex typeE
 the graph edge type
Algorithm class which computes a number of distance related metrics. A summary of various
distance metrics can be found
here.
 Author:
 Joris Kinable, Alexandru Valeanu

Constructor Summary
ConstructorDescriptionGraphMeasurer
(Graph<V, E> graph) Constructs a new instance of GraphMeasurer.GraphMeasurer
(Graph<V, E> graph, ShortestPathAlgorithm<V, E> shortestPathAlgorithm) Constructs a new instance of GraphMeasurer. 
Method Summary
Modifier and TypeMethodDescriptiondouble
Compute the diameter of the graph.Compute the graph center.Compute the graph periphery.Compute the graph pseudoperiphery.double
Compute the radius of the graph.Compute the eccentricity of each vertex in the graph.

Constructor Details

GraphMeasurer
Constructs a new instance of GraphMeasurer.FloydWarshallShortestPaths
is used as the default shortest path algorithm. Parameters:
graph
 input graph

GraphMeasurer
Constructs a new instance of GraphMeasurer. Parameters:
graph
 input graphshortestPathAlgorithm
 shortest path algorithm used to compute shortest paths between all pairs of vertices. Recommended algorithms are:JohnsonShortestPaths
(Runtime complexity: $O(VE + V^2 logV)$) orFloydWarshallShortestPaths
(Runtime complexity: $O(V^3)$.


Method Details

getDiameter
public double getDiameter()Compute the diameter of the graph. The diameter of a graph is defined as $\max_{v\in V}\epsilon(v)$, where $\epsilon(v)$ is the eccentricity of vertex $v$. In other words, this method computes the 'longest shortest path'. Two special cases exist. If the graph has no vertices, the diameter is 0. If the graph is disconnected, the diameter isDouble.POSITIVE_INFINITY
. Returns:
 the diameter of the graph.

getRadius
public double getRadius()Compute the radius of the graph. The radius of a graph is defined as $\min_{v\in V}\epsilon(v)$, where $\epsilon(v)$ is the eccentricity of vertex $v$. Two special cases exist. If the graph has no vertices, the radius is 0. If the graph is disconnected, the diameter isDouble.POSITIVE_INFINITY
. Returns:
 the diameter of the graph.

getVertexEccentricityMap
Compute the eccentricity of each vertex in the graph. The eccentricity of a vertex $u$ is defined as $\max_{v}d(u,v)$, where $d(u,v)$ is the shortest path between vertices $u$ and $v$. If the graph is disconnected, the eccentricity of each vertex isDouble.POSITIVE_INFINITY
. The runtime complexity of this method is $O(n^2+L)$, where $L$ is the runtime complexity of the shortest path algorithm provided during construction of this class. Returns:
 a map containing the eccentricity of each vertex.

getGraphCenter
Compute the graph center. The center of a graph is the set of vertices of graph eccentricity equal to the graph radius. Returns:
 the graph center

getGraphPeriphery
Compute the graph periphery. The periphery of a graph is the set of vertices of graph eccentricity equal to the graph diameter. Returns:
 the graph periphery

getGraphPseudoPeriphery
Compute the graph pseudoperiphery. The pseudoperiphery of a graph is the set of all pseudoperipheral vertices. A pseudoperipheral vertex $v$ has the property that for any vertex $u$, if $v$ is as far away from $u$ as possible, then $u$ is as far away from $v$ as possible. Formally, a vertex $u$ is pseudoperipheral, if for each vertex $v$ with $d(u,v)=\epsilon(u)$ holds $\epsilon(u)=\epsilon(v)$, where $\epsilon(u)$ is the eccentricity of vertex $u$. Returns:
 the graph pseudoperiphery
