centroid_decomposition
Compute centroid decomposition of a tree to obtain centroid parents and depths for efficient tree traversal and hierarchical analysis.
Instructions
Compute the centroid decomposition of a tree, returning centroid parents and depths.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| edges | Yes | Tree edges as [u, v] pairs (must be N-1 edges) | |
| vertex_count | Yes | Number of vertices (max 50,000) |