Class ClosuresEnumeratorAbstract

java.lang.Object
com.jgalgo.alg.closure.ClosuresEnumeratorAbstract
All Implemented Interfaces:
ClosuresEnumerator
Direct Known Subclasses:
ClosuresEnumeratorSchrageBaker

public abstract class ClosuresEnumeratorAbstract extends Object implements ClosuresEnumerator
Abstract class for enumerating over all the closure subsets in a directed graph.

The class implements the interface by solving the problem on the index graph and then maps the results back to the original graph. The implementation for index graphs is abstract and left to the subclasses.

Author:
Barak Ugav
  • Constructor Details

    • ClosuresEnumeratorAbstract

      public ClosuresEnumeratorAbstract()
      Default constructor.
  • Method Details

    • closuresIter

      public <V, E> Iterator<Set<V>> closuresIter(Graph<V,E> g)
      Description copied from interface: ClosuresEnumerator
      Iterate over all closures in the given graph.

      Given a directed graph \(G = (V, E)\), a closure is a subset of vertices \(C \subseteq V\) such that there are no edges from \(C\) to \(V \setminus C\). Although the empty set of vertices is considered a colure, it is not returned by this method.

      If g is IntGraph, the returned iterator will iterate over IntSet objects.

      Specified by:
      closuresIter in interface ClosuresEnumerator
      Type Parameters:
      V - the vertices type
      E - the edges type
      Parameters:
      g - a directed graph
      Returns:
      an iterator that iteration over all closures in the graph