Package org.graph4j.metrics
Class TreeMetrics
java.lang.Object
org.graph4j.GraphAlgorithm
org.graph4j.metrics.GraphMetrics
org.graph4j.metrics.TreeMetrics
Various distances related to a tree.
- Author:
- Cristian Frăsinaru, Ignat Gabriel-Andrei
-
Field Summary
Fields inherited from class org.graph4j.metrics.GraphMetrics
center, diameter, dist, ecc, girth, periphery, pseudoDiameter, radiusFields inherited from class org.graph4j.GraphAlgorithm
directed, graph -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgirth()The girth of a graph is the length of its shortest cycle.doubleComputes an approximation of the graph diameter.Methods inherited from class org.graph4j.metrics.GraphMetrics
averagePathLength, center, diameter, distance, distances, eccentricities, eccentricity, eccentricity, periphery, pseudoPeriphery, radiusMethods inherited from class org.graph4j.GraphAlgorithm
getGraph
-
Constructor Details
-
TreeMetrics
-
-
Method Details
-
girth
public int girth()Description copied from class:GraphMetricsThe girth of a graph is the length of its shortest cycle. Acyclic graphs are considered to have infinite girth.- Overrides:
girthin classGraphMetrics- Returns:
- the girth of the graph, or
Integer.MAX_VALUEif the graph is acyclic.
-
pseudoDiameter
public double pseudoDiameter()Description copied from class:GraphMetricsComputes an approximation of the graph diameter. It works by starting from a vertex u, and finds a vertex v that is farthest away from u. This process is repeated by treating v as the new starting vertex, and ends when the graph distance no longer increases. If either the diameter or eccentricities have been computetd, it returns the diameter of the graph.- Overrides:
pseudoDiameterin classGraphMetrics- Returns:
- the psueudo-diameter of a graph.
-