Centroid decomposition handles range queries as well as exact queries. You replace equality checks with range checks. The decomposition structure does not change. Using sorted data structures or binary indexed trees keeps the range counting efficient.
Each query is , so total time becomes instead of . This pattern extends to weighted paths, XOR paths, and other properties. The centroid decomposition framework is flexible and effective.