So far you have computed values for one root. What if you need the answer for every possible root?
Example: for each node as root, compute the sum of depths of all other nodes. Rerooting is an advanced technique where you compute the answer for one root, then efficiently update to get answers for other roots. You will see this in later sections. It builds on subtree DP by adding a second pass. The first pass computes subtree values. The second pass computes contributions from above.