View source: R/summary.phylo.R
degree | R Documentation |
degree
is a generic function to calculate the degree of all
nodes in a tree or in a network.
degree(x, ...)
## S3 method for class 'phylo'
degree(x, details = FALSE, ...)
## S3 method for class 'evonet'
degree(x, details = FALSE, ...)
x |
an object (tree, network, ...). |
details |
whether to return the degree of each node in the tree, or a summary table (the default). |
... |
arguments passed to methods. |
The degree of a node (or vertex) in a network is defined by the number of branches (or edges) that connect to this node. In a phylogenetic tree, the tips (or terminal nodes) are of degree one, and the (internal) nodes are of degree two or more.
There are currently two methods for the classes "phylo"
and
"evonet"
. The default of these functions is to return a summary
table with the degrees observed in the tree or network in the first
column, and the number of nodes in the second column. If details
= TRUE
, a vector giving the degree of each node (as numbered in the
edge
matrix) is returned.
The validity of the object is not checked, so degree
can be
used to check problems with badly conformed trees.
a data frame if details = FALSE
, or a vector of integers
otherwise.
Emmanuel Paradis
checkValidPhylo
data(bird.orders)
degree(bird.orders)
degree(bird.orders, details = TRUE)
data(bird.families)
degree(bird.families)
degree(rtree(10)) # 10, 1, 8
degree(rtree(10, rooted = FALSE)) # 10, 0, 8
degree(stree(10)) # 10 + 1 node of degree 10
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.