Graph Theory37 sections · 1633 units
Open in Course

Problem - Fixed-Length Paths II

(CSES 2081)

You are given a tree with nn nodes and integers k1k_1 and k2k_2. Count paths with length between k1k_1 and k2k_2 inclusive. This is a generalization of the previous problem. This is a generalization of Fixed-Length Paths I.

Instead of exactly kk edges, you count paths with k1lengthk2k_1 \le \text{length} \le k_2. The centroid decomposition structure remains the same. The same centroid decomposition approach works with a small modification to the counting step. You will count ranges instead of exact values.