TOC Toolkit API - v0.1.0
    Preparing search index...

    Function stronglyConnectedComponents

    • Returns the strongly connected components of a graph whose nodes are the integers from 0 up to size. Two nodes are in the same component when a path leads from each one to the other. Every node is in one component.

      A component comes after every component that its edges lead to, so the list is a reverse topological order of the components.

      The search is the algorithm of Tarjan with its own stack in place of recursion, so a long path does not overflow the call stack. It takes time linear in the number of nodes and edges.

      Parameters

      Returns readonly (readonly number[])[]