Class StronglyConnectedComponentsFast<N>


  • public class StronglyConnectedComponentsFast<N>
    extends Object
    Identifies and provides an interface to query the strongly-connected components of DirectedGraph instances. Uses Tarjan's algorithm.
    Author:
    Eric Bodden Changes: 2015/08/23 Steven Arzt, added an iterative version of Tarjan's algorithm for large graphs
    See Also:
    DirectedGraph
    • Constructor Detail

      • StronglyConnectedComponentsFast

        public StronglyConnectedComponentsFast​(DirectedGraph<N> g)
        Parameters:
        g - a graph for which we want to compute the strongly connected components.
        See Also:
        DirectedGraph
    • Method Detail

      • recurse

        protected void recurse​(N v)
      • iterate

        protected void iterate​(N x)
      • getComponents

        public List<List<N>> getComponents()
        Returns:
        the list of the strongly-connected components
      • getTrueComponents

        public List<List<N>> getTrueComponents()
        Returns:
        the list of the strongly-connected components, but only those that are true components, i.e. components which have more than one element or consists of one node that has itself as a successor