Class TreeMetrics


public class TreeMetrics extends GraphMetrics
Various distances related to a tree.
Author:
Cristian Frăsinaru, Ignat Gabriel-Andrei
  • Constructor Details

    • TreeMetrics

      public TreeMetrics(Graph graph)
  • Method Details

    • girth

      public int girth()
      Description copied from class: GraphMetrics
      The girth of a graph is the length of its shortest cycle. Acyclic graphs are considered to have infinite girth.
      Overrides:
      girth in class GraphMetrics
      Returns:
      the girth of the graph, or Integer.MAX_VALUE if the graph is acyclic.
    • pseudoDiameter

      public double pseudoDiameter()
      Description copied from class: GraphMetrics
      Computes 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:
      pseudoDiameter in class GraphMetrics
      Returns:
      the psueudo-diameter of a graph.