Tracing a polynomial algorithm for the problem of maximum-weight independent set
It won't matter which node you select as the root, in the sense that the algorithm will always find a maximum-weight independent set. The actual set of nodes selected by the algorithm might differ, if there are multiple maximum-weight solutions. 

Let's say the root is the node with weight 2. Either it is in the optimal solution, or it isn't. 


If it is, then 7, 10, and 7 are not; the remaining tree only contains 4. Thus this solution has weight 2 + 4 = 6. 
If it is not, then the answer is the maximum-weight independent set on the forest in which the components are the subtrees with weight 7, 10, and (7, 4). Solving the problem recursively on the subtrees gives 7 + 10 + 7 = 24. 


Since 24 > 6, the answer is 24.