Learn
Practice
Newsletter
Resources
F
Toggle theme
0
F
Toggle theme
0
Toggle menu
← Back to All Animations
Heavy-Light Decomposition
Bookmark
Input
Standard (7 nodes)
Deep left (9 nodes)
Path graph (5 nodes)
Wide root (7 nodes)
Custom
edges
=
[[0,1],[0,2],[1,3],[1,4],[2,5],[3,6]]
,
numNodes
=
7
,
queryU
=
6
,
queryV
=
5
0
1
2
3
4
5
6
Unprocessed
Processed
Active
Heavy/Path
Heavy Edge
Light
algo
master
.
io
Step:
Start: We have a rooted tree with root = 0. We will perform Heavy-Light Decomposition.
0 / 24
Input
Standard (7 nodes)
Deep left (9 nodes)
Path graph (5 nodes)
Wide root (7 nodes)
Custom
edges
=
[[0,1],[0,2],[1,3],[1,4],[2,5],[3,6]]
,
numNodes
=
7
,
queryU
=
6
,
queryV
=
5
0 / 24
0
1
2
3
4
5
6
Unprocessed
Processed
Active
Heavy/Path
Heavy Edge
Light
algo
master
.
io
Step:
Start: We have a rooted tree with root = 0. We will perform Heavy-Light Decomposition.