Class TriangleCounter

java.lang.Object
org.graph4j.UndirectedGraphAlgorithm
org.graph4j.measures.TriangleCounter

public class TriangleCounter extends UndirectedGraphAlgorithm
Counts the number of triangles in an undirected graph. A triangle is formed by three distinct vertices all connected with each other. Complexity O(|E|^{3/2}). See Ullman, Jeffrey: "Mining of Massive Datasets", Chapter 10.
Author:
Cristian Frăsinaru, Gabriel Ignat
  • Constructor Details

    • TriangleCounter

      public TriangleCounter(Graph graph)
  • Method Details

    • count

      public long count()
      Returns:
      the number of triangles in the graph.