Skip to content

eles.tarjanStronglyConnected()

eles.tarjanStronglyConnected — Collection > Algorithms > Connectivity and Eulerian paths. Cytoscape.js signatures, parameters and return contract.

eles.tarjanStronglyConnected — Collection › Algorithms › Connectivity and Eulerian paths

Preview · Collection › Algorithms › Connectivity and Eulerian paths

Read in the complete API reference · All API members

// Partition this collection's directed subgraph into strongly connected components
eles.tarjanStronglyConnected(): TarjanStronglyConnectedResult

Partition this collection's directed subgraph into strongly connected components. Traversal follows edge direction; self-loops do not join otherwise separate nodes. The implementation is iterative, so deep graphs do not consume the JavaScript call stack.

Returns TarjanStronglyConnectedResult

{ components, cut }: each component collection contains its nodes and internal edges; cut contains edges between components

Example

console.log(eles.tarjanStronglyConnected().components.length); // 3

Example graph and handle setup

Also spelled eles.tsc, eles.tscc, eles.tarjanStronglyConnectedComponents.