Maximizing Sum of Minimum Edge Weights on Tree Paths

Given a tree with n nodes (≤ 10⁶) and weighted edges, define Min(x, y) as the minimum edge weight along the unique path between nodes x and y. The goal is to compute: max_{r=1}^n Σ_{v ≠ r} Min(r, v) A naive approach would compute the sum for each root r by traversing all paths, yielding O(n²) complexity — infeasible for large n. Instead, revers ...

Posted on Sun, 16 Aug 2026 16:36:12 +0000 by Dasndan