Iterate over tree nodes instead of edges