Common aggregation operations:
Sum: dp[v] = Σ_c in children(v) dp[c]
Max: dp[v] = max_c in children(v) dp[c]
Count: dp[v] = |\{c : dp[c] > 0\}|
Pick the operation that matches your problem. Subtree size uses sum. Maximum path uses max. The aggregation function determines how you combine child answers into the parent answer.