% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tree_properties.R
\name{RootNode}
\alias{RootNode}
\title{Which node is a tree's root?}
\usage{
RootNode(x)
}
\arguments{
\item{x}{A tree of class \code{phylo}, or its edge matrix; or a list or
\code{multiPhylo} object containing multiple trees.}
}
\value{
\code{RootNode()} returns an integer denoting the root node for each tree.
Badly conformed trees trigger an error.
}
\description{
\code{RootNode()} identifies the root node of a (rooted or unrooted) phylogenetic
tree.
Unrooted trees are represented internally by a rooted tree with a polytomy
at the root.
}
\examples{
RootNode(BalancedTree(8))
RootNode(UnrootTree(BalancedTree(8)))


}
\seealso{
Test whether a tree is rooted: \code{\link[=TreeIsRooted]{TreeIsRooted()}}

\code{phangorn::getRoot()}

Other tree navigation:
\code{\link[=AncestorEdge]{AncestorEdge()}},
\code{\link[=CladeSizes]{CladeSizes()}},
\code{\link[=DescendantEdges]{DescendantEdges()}},
\code{\link[=EdgeAncestry]{EdgeAncestry()}},
\code{\link[=EdgeDistances]{EdgeDistances()}},
\code{\link[=ListAncestors]{ListAncestors()}},
\code{\link[=MRCA]{MRCA()}},
\code{\link[=MatchEdges]{MatchEdges()}},
\code{\link[=NDescendants]{NDescendants()}},
\code{\link[=NodeDepth]{NodeDepth()}},
\code{\link[=NodeNumbers]{NodeNumbers()}},
\code{\link[=NodeOrder]{NodeOrder()}},
\code{\link[=PaintTree]{PaintTree()}}
}
\author{
\href{https://orcid.org/0000-0001-5660-1727}{Martin R. Smith}
(\href{mailto:martin.smith@durham.ac.uk}{martin.smith@durham.ac.uk})
}
\concept{tree navigation}
