Skip to content
StackDecode
GraphsExplained

Tarjan's Algorithm

One DFS with low-link values and a stack finds all SCCs.

Time

O(V + E)

Extra space

O(V)

Use it for

Strongly connected components in one pass.

An animated walkthrough for this algorithm isn’t built yet. The summary above explains the idea; see the related animated algorithms below to practise the same technique.