The loop inside the recursive navigate function is meant to explore all the successors of a given node. depthInc is needed to track which depth level has been reached, but the depth level is about the successor, not the current node.
Thus, it needs to be reset on each iteration.
The loop inside the recursive
navigate
function is meant to explore all the successors of a given node.depthInc
is needed to track which depth level has been reached, but the depth level is about the successor, not the current node. Thus, it needs to be reset on each iteration.Signed-off-by: Alessandro Carminati alessandro.carminati@gmail.com