Tarjan's algorithm (strongly connected components)

symphonic, cinematic, dramatic, orchestral

Listen on 93

Lyrics

[Verse 1]
Graph traversal genius, Tarjan's the architect
DFS with timestamps, precision intellect
Discovery time stamped when we first arrive
Low-link value tracks the earliest reachable alive
Stack maintains the path, vertices in queue
When discovery equals low-link, component's breaking through

[Chorus]
Stack it, track it, timestamp every node
Discovery low-link, crack the secret code
Strongly connected, cycles intertwined
Pop until you drop, components redefined
Tarjan's algorithm, one pass through the maze
Linear time complexity, efficiency pays

[Verse 2]
Start the journey deep, mark discovery clock
Push onto the stack, vertices we stock
Calculate low-link from the minimum found
Neighbors unexplored or stack-bound and sound
Recursive descent through edges we chase
Back-propagate values, low-link we replace

[Chorus]
Stack it, track it, timestamp every node
Discovery low-link, crack the secret code
Strongly connected, cycles intertwined
Pop until you drop, components redefined
Tarjan's algorithm, one pass through the maze
Linear time complexity, efficiency pays

[Bridge]
When discovery equals low-link at the peak
Root of component, that's the node we seek
Pop the stack complete until we reach the start
Every vertex popped becomes component part
Mutual reachability, cycles form the bond
Strongly connected clusters, mathematics beyond

[Verse 3]
Bridge detection mastery, cut-vertex hunt
Critical connections, Tarjan pulls the stunt
Articulation points where networks might divide
Low-link calculations never gonna hide
Single traversal power, elegant design
Graph theory mastery, algorithm divine

[Chorus]
Stack it, track it, timestamp every node
Discovery low-link, crack the secret code
Strongly connected, cycles intertwined
Pop until you drop, components redefined
Tarjan's algorithm, one pass through the maze
Linear time complexity, efficiency pays

[Outro]
Robert Tarjan's legacy, graph algorithms king
Strongly connected components, let the knowledge ring

← Topological sort | Kosaraju's algorithm →