ReduceTrees: Collapse areas of agreement between two trees

View source: R/Reduce.R

ReduceTreesR Documentation

Collapse areas of agreement between two trees

Description

ReduceTrees() reduces trees according to the tree reduction rules of \insertCiteAllen2001;textualTreeDist:

  • Collapse identical pendant subtrees;

  • Compress equivalent internal chains.

Usage

ReduceTrees(tree1, tree2, check = TRUE)

Arguments

tree1, tree2

Single trees of class phylo to undergo comparison.

check

Logical specifying whether to validate input. Specify FALSE and you will encounter undefined behaviour if trees are not binary phylo objects with identical leaf labels, rooted on leaf 1.

Value

ReduceTrees() returns a list of two trees, corresponding to tree1 and tree2 after any identical groupings have been collapsed, with tree edges listed in postorder; or NULL if the trees are equivalent.

Author(s)

Martin R. Smith (martin.smith@durham.ac.uk)

Examples

tree1 <- TreeTools::BalancedTree(9)
tree2 <- TreeTools::PectinateTree(9)

# Set graphical parameters
oPar <- par(mai = rep(0.1, 4), mfrow = c(2, 2))

plot(tree1)
plot(tree2)

# Reduce trees by collapsing identical clades
confl <- ReduceTrees(tree1, tree2)

plot(confl[[1]])
plot(confl[[2]])

# Restore graphical parameters
par(oPar)

ms609/TreeDist documentation built on June 30, 2024, 7:18 p.m.