Macaulay2 » Documentation
Packages » Graphs :: stronglyConnectedComponents
next | previous | forward | backward | up | index | toc

stronglyConnectedComponents -- finds the strongly connected components of a digraph

Description

Two vertices belong to the same component when each is reachable from the other. The order of the components and their vertices is unspecified. The implementation uses Tarjan's algorithm with an explicit depth-first search stack.

i1 : D = digraph({1,2,3,4}, {{1,2},{2,1},{2,3},{3,4},{4,3}}, EntryMode => "edges");
i2 : stronglyConnectedComponents D

o2 = {{4, 3}, {2, 1}}

o2 : List

See also

Ways to use stronglyConnectedComponents:

  • stronglyConnectedComponents(Digraph)

For the programmer

The object stronglyConnectedComponents is a method function.


The source of this document is in /build/reproducible-path/macaulay2-1.26.11+ds/M2/Macaulay2/packages/Graphs.m2:4779:0.