is.binary.tree: Test for Binary Tree

View source: R/is.binary.tree.R

is.binaryR Documentation

Test for Binary Tree

Description

This function tests whether a phylogenetic tree is binary.

Usage

is.binary(phy)
## S3 method for class 'phylo'
is.binary(phy)
## S3 method for class 'multiPhylo'
is.binary(phy)
## S3 method for class 'tree'
is.binary(phy)

Arguments

phy

an object of class "phylo" or "multiPhylo".

Details

The test differs whether the tree is rooted or not. An urooted tree is considered binary if all its nodes are of degree three (i.e., three edges connect to each node). A rooted tree is considered binary if all nodes (including the root node) have exactly two descendant nodes, so that they are of degree three expect the root which is of degree 2.

The test ignores branch lengths. Consider using di2multi if you want to treat zero-branch lengths as resulting from multichotomies.

is.binary.tree is deprecated and will be removed soon: currently it calls is.binary.

Value

a logical vector.

Author(s)

Emmanuel Paradis

See Also

is.rooted, is.ultrametric, multi2di

Examples

is.binary(rtree(10))
is.binary(rtree(10, rooted = FALSE))
is.binary(stree(10))
x <- setNames(rmtree(10, 10), LETTERS[1:10])
is.binary(x)

ape documentation built on May 29, 2024, 10:50 a.m.