Find the centroid of the whole tree and remove it. Find centroids of each remaining component and remove them. Repeat until all nodes are removed. This removal process creates a hierarchy. The order of removal forms a tree: the first centroid is the root, centroids of the components are its children, and so on.
This is the centroid decomposition tree. It is different from the original tree. It is a different tree structure imposed on the same nodes. Original edges do not matter here, only the removal order. This new structure has depth.
Space complexity is for the data structures used.