rerooting
Rerooting is a term used in multiple fields, most notably in graph theory and in horticulture. In graph theory and related algorithm design, rerooting refers to a dynamic programming technique for computing values for all possible roots of a tree. It relies on two passes: a bottom-up pass computes DP values with respect to an initial root; a top-down pass updates those values as the root shifts to neighboring nodes. The approach often uses associativity and commutativity of a combining operation, along with prefix and suffix accumulations to merge contributions from different branches efficiently.
Applications include calculating, for every node treated as root, quantities such as the sum of distances to
In biology and horticulture, rerooting is used informally to describe processes that establish or shift a plant’s