code: def searchRootOfTree(reducibleChildren: Set[LNode], nodeFromTree: LNode):
      
  
      while True:
          out_e = nodeFromTree.east[0].outgoingEdges
          # node has no successors
          if not out_e:
              return nodeFromTree
  
          nextNode = out_e[0].dsts[0].parentNode
          if nextNode in reducibleChildren:
              # can reduce node, walk the tree to root
              nodeFromTree = nextNode
          else:
              # can not reduce, return last root of tree
              return nodeFromTree
docs: Walk tree of nodes to root
  
      :param reducibleChildren: nodes which are part of tree
      :param nodeFromTree: node where to start the search