is_bifurcating: Determine if a tree is bifurcating.

View source: R/is_bifurcating.R

is_bifurcatingR Documentation

Determine if a tree is bifurcating.

Description

This function determines if a tree is strictly bifurcating, i.e. each node has exactly 2 children. If a tree has monofurcations or multifurcations, this function returns FALSE.

Usage

is_bifurcating(tree)

Arguments

tree

A tree of class "phylo".

Details

This functions accepts rooted and unrooted trees, that may include monofurcations, bifurcations and multifurcations.

Value

A logical, indicating whether the input tree is strictly bifurcating.

Author(s)

Stilianos Louca

Examples

# generate random tree
Ntips = 10
tree  = generate_random_tree(list(birth_rate_intercept=1),max_tips=Ntips)$tree

# check if the tree is bifurcating (as expected)
is_bifurcating(tree)

castor documentation built on Aug. 18, 2023, 1:07 a.m.