pub fn build_centroid_tree(
adj: &[Vec<usize>],
) -> (Vec<Option<usize>>, Vec<usize>)Expand description
Build the centroid decomposition of the tree adj.
Returns two vectors of length n:
parent[v]— the centroid at the level abovevin the decomposition (i.e., the centroid chosen for the component that containedvin the previous recursion step).Nonefor the root of the centroid tree.depth[v]— depth ofvin the centroid tree (0 for the root).
§Panics
Panics if adj is empty.