A strongly connected componentis a maximal set of nodes where every node can reach every other node through directed edges. Tarjan's algorithm finds all SCCs in a single depth-first traversal. Robert Tarjan published it in 1972.
The algorithm maintains a stack of nodes in the current DFS path. Each node tracks a discovery time (when DFS first visits it) and a low-link value (the smallest discovery time reachable from its subtree through back edges). As DFS unwinds, low-link values propagate upward.
When a node's low-link equals its own discovery time, it is the root of an SCC. Everything above it on the stack, up to and including itself, forms the component. Those nodes are popped and grouped together. The algorithm runs in O(V + E) time, making a single pass over the graph.
Watch the discovery times increment as DFS visits each node, and the low-link values update as back edges are found. When a root is identified, the entire component highlights at once. Add edges to create cycles and see how the SCC structure changes.
Wikipedia