Class SCCs


  • public final class SCCs
    extends Object
    Algorithms for finding strongly-connected components (SCCs) in a graph.
    • Method Detail

      • collectSCCs

        public static <N,​E> List<List<N>> collectSCCs​(Graph<N,​E> graph)
        Collects all strongly-connected components in a graph. The SCCs are returned as a list of lists.

        Tarjan's algorithm is used for realizing the SCC search.

        Parameters:
        graph - the graph
        Returns:
        a list of all SCCs, each represented as a list of its nodes
        See Also:
        TarjanSCCVisitor
      • findSCCs

        public static <N,​E> void findSCCs​(Graph<N,​E> graph,
                                                SCCListener<N> listener)
        Find all strongly-connected components in a graph. When a new SCC is found, the SCCListener.foundSCC(java.util.Collection) method is invoked. The listener object may hence not be null.

        Tarjan's algorithm is used for realizing the SCC search.

        Parameters:
        graph - the graph
        listener - the SCC listener
        See Also:
        TarjanSCCVisitor