stronglyConnectedComponents
fun <V> stronglyConnectedComponents(graph: DirectedGraph<V, *>, includeSingletons: Boolean): Set<Set<V>>(source)
Computes the strongly connected components of a given directed graph using Tarjan's algorithm. A strongly connected component (SCC) is a maximal subgraph where every vertex is reachable from every other vertex in the same subgraph.
Return
A set of strongly connected components, each represented as a set of vertices.
Parameters
V
The type representing the vertices in the graph.
graph
The directed graph to compute the SCCs for. It must be an instance of DirectedGraph.
includeSingletons
A boolean flag indicating whether to include single-vertex components (vertices without edges) as separate SCCs in the result.