Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Tarjan's SCC Algorithm
Bookmark
Input
3 SCCs
2 SCCs
Simple
Custom
n
=
8
,
edges
=
[[0,1],[1,2],[2,0],[3,4],[4,5],[5,3],[6,7],[7,6],[2,3],[5,6]]
0
1
2
3
4
5
6
7
Stack
(empty)
disc
-
-
-
-
-
-
-
-
low
-
-
-
-
-
-
-
-
0
1
2
3
4
5
6
7
Legend:
Unvisited
On Stack
SCC Found
disc == low (SCC root)
0
1
2
3
4
5
6
7
Stack
(empty)
disc
-
-
-
-
-
-
-
-
low
-
-
-
-
-
-
-
-
0
1
2
3
4
5
6
7
Legend:
Unvisited
On Stack
SCC Found
disc == low (SCC root)
0
1
2
3
4
5
6
7
curr
Stack
1
top
0
disc
0
1
-
-
-
-
-
-
low
0
1
-
-
-
-
-
-
0
1
2
3
4
5
6
7
Legend:
Unvisited
On Stack
SCC Found
disc == low (SCC root)
0
1
2
3
4
5
6
7
curr
Stack
2
top
1
0
disc
0
1
2
-
-
-
-
-
low
0
1
0
-
-
-
-
-
0
1
2
3
4
5
6
7
Legend:
Unvisited
On Stack
SCC Found
disc == low (SCC root)
0
1
2
3
4
5
6
7
curr
Stack
4
top
3
2
1
0
disc
0
1
2
3
4
-
-
-
low
0
1
0
3
4
-
-
-
0
1
2
3
4
5
6
7
Legend:
Unvisited
On Stack
SCC Found
disc == low (SCC root)
0
1
2
3
4
5
6
7
curr
Stack
6
top
5
4
3
2
1
0
disc
0
1
2
3
4
5
6
-
low
0
1
0
3
4
3
6
-
0
1
2
3
4
5
6
7
Legend:
Unvisited
On Stack
SCC Found
disc == low (SCC root)
0
1
2
3
4
5
6
7
curr
Stack
7
top
6
5
4
3
2
1
0
disc
0
1
2
3
4
5
6
7
low
0
1
0
3
4
3
6
6
0
1
2
3
4
5
6
7
Legend:
Unvisited
On Stack
SCC Found
disc == low (SCC root)
0
1
2
3
4
5
6
7
curr
Stack
5
top
4
3
2
1
0
disc
0
1
2
3
4
5
6
7
low
0
1
0
3
4
3
6
6
0
1
2
3
4
5
6
7
Legend:
Unvisited
On Stack
SCC Found
disc == low (SCC root)
0
1
2
3
4
5
6
7
curr
Stack
5
top
4
3
2
1
0
disc
0
1
2
3
4
5
6
7
low
0
1
0
3
3
3
6
6
0
1
2
3
4
5
6
7
Legend:
Unvisited
On Stack
SCC Found
disc == low (SCC root)
0
1
2
3
4
5
6
7
curr
Stack
2
top
1
0
disc
0
1
2
3
4
5
6
7
low
0
0
0
3
3
3
6
6
0
1
2
3
4
5
6
7
Legend:
Unvisited
On Stack
SCC Found
disc == low (SCC root)
0
1
2
3
4
5
6
7
Stack
(empty)
disc
0
1
2
3
4
5
6
7
low
0
0
0
3
3
3
6
6
0
1
2
3
4
5
6
7
Legend:
Unvisited
On Stack
SCC Found
disc == low (SCC root)
algo
master
.
io
Step:
Start: Tarjan's SCC Algorithm
0 / 35
Input
3 SCCs
2 SCCs
Simple
Custom
n
=
8
,
edges
=
[[0,1],[1,2],[2,0],[3,4],[4,5],[5,3],[6,7],[7,6],[2,3],[5,6]]
0 / 35
algo
master
.
io
Step:
Start: Tarjan's SCC Algorithm