Class BronKerboschCliqueIterator

java.lang.Object
org.graph4j.SimpleGraphAlgorithm
org.graph4j.clique.BronKerboschCliqueIterator
All Implemented Interfaces:
CliqueIterator, MaximalCliqueIterator

public class BronKerboschCliqueIterator extends SimpleGraphAlgorithm implements MaximalCliqueIterator
Iterates over all the maximal cliques of a graph. Implemented after: Etsuji Tomita, Akira Tanaka, Haruhisa Takahashi, "The worst-case time complexity for generating all maximal cliques and computational experiments".
Author:
Cristian Frăsinaru
  • Constructor Details

    • BronKerboschCliqueIterator

      public BronKerboschCliqueIterator(Graph graph)
      Parameters:
      graph - the input graph.
    • BronKerboschCliqueIterator

      public BronKerboschCliqueIterator(Graph graph, boolean shuffle, boolean useAdjacencyMatrix)
      Using the adjacency matrix allows for a slightly faster execution of the algorithm, at the expense of using more memory.Not recommended for large sparse graphs.
      Parameters:
      graph - the input graph.
      shuffle - if the vertices are shuffled before.
      useAdjacencyMatrix - true if the algorithm will compute and use the adjacency matrix of the graph in order to test if two vertices are adjacent.
  • Method Details

    • next

      public Clique next()
      Specified by:
      next in interface CliqueIterator
      Returns:
      the next element in the iteration.
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface CliqueIterator
      Returns:
      true if the iteration has more elements.