My data frame looks as below with left node and right node.Left node points to right node in tree and then right node points to left node in next level. I want to put a tree number for each row. Please see step for each of row evaluation below. How do I get Tree number on each of DF row?
Left_node Right_node logic_needed(steps)
1 2 1 : (Tree1 : 1 points to 2)
1 3 2 : (Tree1 : 1(left node, found in step1) points to 3)
4 2 3 : (Tree1 : 2(right node, found in step1) points to 4)
5 2 4 : (Tree1 : 2(right node, found in step1) points to 5)
6 3 5 : (Tree1 : 3(right node, found in step2) points to 6)
6 9 6 : (Tree1 : 6(left node, found in step 5) points to 9)
7 8. 7 : (Tree2 : 7 is new Tree, not traversed before, points to 8)
11 5 7 : (Tree2 : 7(right now, found in step 7) points to 5)