Class GraphMeasures

java.lang.Object
org.graph4j.measures.GraphMeasures

public class GraphMeasures extends Object
Various sizes related to graphs.
Author:
Cristian Frăsinaru
  • Constructor Details

    • GraphMeasures

      public GraphMeasures()
  • Method Details

    • density

      public static double density(Graph graph)
      Parameters:
      graph - the input graph.
      Returns:
      the density of the graph.
    • minDegree

      public static int minDegree(Graph graph)
      Determines the minimum degree of the vertices.
      Parameters:
      graph - the input graph.
      Returns:
      the minimum degree of the vertices.
    • minDegreeVertex

      public static int minDegreeVertex(Graph graph)
      Determines a vertex with minimum degree.
      Parameters:
      graph - the input graph.
      Returns:
      a vertex number of minimum degree.
    • maxDegree

      public static int maxDegree(Graph graph)
      Parameters:
      graph - the input graph.
      Returns:
      the maximum degree of the vertices.
    • maxDegreeVertex

      public static int maxDegreeVertex(Graph graph)
      Parameters:
      graph - the input graph.
      Returns:
      a vertex number of maximum degree.
    • avgDegree

      public static double avgDegree(Graph graph)
      Parameters:
      graph - the input graph.
      Returns:
      the average degree of the vertices.
    • degreeHistogram

      public static int[] degreeHistogram(Graph graph)
      The degree histogram counts how many vertices have a specific degree in the graph. If degreeHistogram(g)[i]=k then there are k vertices having the degree i.
      Parameters:
      graph - the input graph.
      Returns:
      the degree histogram of the graph.
    • degreeDistribution

      public static double[] degreeDistribution(Graph graph)
      The degree distribution is the probability distribution P of the graph degrees over the whole graph. If there are n vertices in the graph and nk of them have degree k, we have P(k)=nk/n.
      Parameters:
      graph - the input graph.
      Returns:
      the degree distribution of the graph.
    • numberOfTriangles

      public static long numberOfTriangles(Graph graph)
      A triangle is formed by three distinct vertices connected all with each other.
      Parameters:
      graph - the input graph.
      Returns:
      the number of triangles in the graph.
      See Also:
    • numberOfTriplets

      public static long numberOfTriplets(Graph graph)
      A triplet is formed by three distinct vertices that are connected by either two (open triplet) or three (closed triplet) undirected edges. A triangle graph therefore includes three closed triplets.
      Parameters:
      graph - the input graph.
      Returns:
      the number of triplets in an undirected graph.
    • density

      public static double density(Digraph digraph)
      Parameters:
      digraph - the input digraph.
      Returns:
      the density of the digraph.
    • minIndegree

      public static int minIndegree(Digraph digraph)
      Determines the minimum indegree of the vertices.
      Parameters:
      digraph - the input digraph.
      Returns:
      the minimum indegree of the vertices.
    • minIndegreeVertex

      public static int minIndegreeVertex(Digraph digraph)
      Determines a vertex with minimum indegree.
      Parameters:
      digraph - the input digraph.
      Returns:
      a vertex number of minimum indegree.
    • maxIndegree

      public static int maxIndegree(Digraph digraph)
      Determines the maximum indegree of the vertices.
      Parameters:
      digraph - the input digraph.
      Returns:
      the maximum indegree of the vertices.
    • maxIndegreeVertex

      public static int maxIndegreeVertex(Digraph digraph)
      Determines a vertex with maximum indegree.
      Parameters:
      digraph - the input digraph.
      Returns:
      a vertex number of maximum indegree.
    • avgIndegree

      public static double avgIndegree(Digraph digraph)
      Determines the average indegree of vertices.
      Parameters:
      digraph - the input digraph.
      Returns:
      the average indegree of the vertices.
    • indegreeHistogram

      public static int[] indegreeHistogram(Digraph digraph)
      The indegree histogram counts how many vertices have a specific indegree in the digraph. If indegreeHistogram(g)[i]=k then there are k vertices having the indegree i.
      Parameters:
      digraph - the input digraph.
      Returns:
      the indegree histogram of the digraph.
    • minOutdegree

      public static int minOutdegree(Digraph digraph)
      Determines the minimum outdegree of the vertices.
      Parameters:
      digraph - the input digraph.
      Returns:
      the minimum outdegree of the vertices.
    • minOutdegreeVertex

      public static int minOutdegreeVertex(Digraph digraph)
      Determines a vertex with minimum outdegree.
      Parameters:
      digraph - the input digraph.
      Returns:
      a vertex number of minimum outdegree.
    • maxOutdegree

      public static int maxOutdegree(Digraph digraph)
      Determines the maximum outdegree of the vertices.
      Parameters:
      digraph - the input digraph.
      Returns:
      the maximum outdegree of the vertices.
    • maxOutdegreeVertex

      public static int maxOutdegreeVertex(Digraph digraph)
      Determines a vertex with maximum outdegree.
      Parameters:
      digraph - the input digraph.
      Returns:
      a vertex number of maximum outdegree.
    • avgOutdegree

      public static double avgOutdegree(Digraph digraph)
      Determines the average outdegree of vertices.
      Parameters:
      digraph - the input digraph.
      Returns:
      the average outdegree of the vertices.
    • outdegreeHistogram

      public static int[] outdegreeHistogram(Digraph digraph)
      The outdegree histogram counts how many vertices have a specific outdegree in the digraph. If outdegreeHistogram(g)[i]=k then there are k vertices having the outdegree i.
      Parameters:
      digraph - the input digraph.
      Returns:
      the outdegree histogram of the digraph.