dfs that takes the current node index as an argument.take and not_take, to store the maximum sum including or excluding the edge to the current node.dfs to get the take and not_take values for the child.
b. Add the maximum of the child's take and not_take to the current node's not_take.
c. Update the current node's take with the maximum of the current take and the sum of the child's not_take plus the weight of the edge to that child.dfs on the root node and return the maximum of the take and not_take values obtained.