Problem 2581 · Hard

Count Number of Possible Root Nodes

Changing the root only flips the one edge between the old and new root, so every root can be scored from its neighbour in one rerooting pass.

Open the interactive visualisation