Attribute referencing the root node of the tree.

        :returns: the root node of the tree containing this instance.
        :rtype: Node
779693
def _root(self):
        
        _n = self
        while _n.parent:
            _n = _n.parent
        return _n
214070
def get_roots(self):
        
        return [node for node, in_degree in dict(self.in_degree()).items() if in_degree == 0]
517633
public static TreeElement getRoot(TreeElement node)
    {
        TreeElement parentNode = node.getParent();
        while (parentNode != null) {
            node = parentNode;
            parentNode = node.getParent();
        }
        return node;
    }
953107
def CurrentNode(self):
        
        ret = libxml2mod.xmlTextReaderCurrentNode(self._o)
        if ret is None:raise treeError('xmlTextReaderCurrentNode() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
915378
def root(self):
        
        node = self
        while node.package is not None:
            node = node.package
        return node
159864
def node_ancestor(node, levels)
      while levels > 0
        node = node.node_parent
        return unless node
        levels -= 1
      end

      node
    end
1330557
public Node getScopeRoot() {
    int roots = scopeRoots.size();
    if (roots > 0) {
      return scopeRoots.get(roots - 1);
    } else {
      AbstractScope<?, ?> s = scopes.peek();
      return s != null ? s.getRootNode() : null;
    }
  }
692954
def tree():
    
    root = ('', logging.root, [])
    nodes = {}
    items = list(logging.root.manager.loggerDict.items())  # for Python 2 and 3
    items.sort()
    for name, logger in items:
        nodes[name] = node = (name, logger, [])
        i = name.rfind('.', 0, len(name) - 1)  # same formula used in `logging`
        if i == -1:
            parent = root
        else:
            parent = nodes[name[:i]]
        parent[2].append(node)
    return root
385861
def root(self):
        
        root = self
        while root.parent is not None:
            root = root.parent
        return root
1224385
def contextNode(self):
        
        ret = libxml2mod.xmlXPathGetContextNode(self._o)
        if ret is None:raise xpathError('xmlXPathGetContextNode() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
678111
def parent(self):
        
        parent_impl_node = self.adapter.get_node_parent(self.impl_node)
        return self.adapter.wrap_node(
            parent_impl_node, self.adapter.impl_document, self.adapter)
954014
def lstree(self, astr_path=""):
            
            self.sCore.reset()
            str_cwd       = self.cwd()
            if len(astr_path): self.cdnode(astr_path)
            str_ls        = '%s' % self.snode_current
            print(str_ls)
            if len(astr_path): self.cdnode(str_cwd)
            return str_ls
331011
def node(self):
        

        if self.node_class is None:
            raise ValueError("You have to create an ``Item`` by calling ``__init__`` with ``node_class`` argument"
                             " or by decorating a ``Node`` class.")

        node = self.node_class(*self.node_args, **self.node_kwargs)
        node.__item__ = self

        return node
447153
public ElementBase getRoot() {
        ElementBase root = this;
        
        while (root.getParent() != null) {
            root = root.getParent();
        }
        
        return root;
    }
1037820
def nodes(self):
        
        if not hasattr(self, '_nodes'):
            base_url = "{}/{}".format(NodeBalancerConfig.api_endpoint, NodeBalancerNode.derived_url_path)
            result = self._client._get_objects(base_url, NodeBalancerNode, model=self, parent_id=(self.id, self.nodebalancer_id))

            self._set('_nodes', result)

        return self._nodes
277259
def root_node(self, value):
        

        if value is not None:
            assert issubclass(value.__class__, AbstractCompositeNode), \
                "'{0}' attribute: '{1}' is not a '{2}' subclass!".format(
                    "root_node", value, AbstractCompositeNode.__name__)
        self.__root_node = value
390266
def get_relname_and_parent(self, treepos):
        
        node = self.dgtree[treepos]
        node_type = get_node_type(node)
        assert node_type in (TreeNodeTypes.relation_node, TreeNodeTypes.leaf_node)

        parent_pos = self.get_parent_treepos(treepos)
        if parent_pos is None:  # a root node has no upward relation
            return None, None
        else:
            parent_label = self.get_parent_label(treepos)
            grandparent_pos = self.get_parent_treepos(parent_pos)

            if grandparent_pos is None:
                # a tree with only one EDU/leaf and a 'N' parent but no relation
                return None, None
            else:
                grandparent_id = self.get_node_id(grandparent_pos)
                grandparent_label = self.get_parent_label(parent_pos)
                reltype = self.get_reltype(grandparent_label)

                if reltype == 'rst':
                    if parent_label == 'N':
                        return 'span', grandparent_id
                    elif parent_label == 'S':
                        cousins_pos = self.get_cousins_treepos(treepos)
                        assert len(cousins_pos) == 1
                        cousin_id = self.get_node_id(cousins_pos[0])
                        return grandparent_label, cousin_id
                elif reltype == 'multinuc':
                    return grandparent_label, grandparent_id