PCMBase (version 1.2.14)

PCMTreeListAllPartitions: A list of all possible (including recursive) partitions of a tree

Description

A list of all possible (including recursive) partitions of a tree

Usage

PCMTreeListAllPartitions(
  tree,
  minCladeSize,
  skipNodes = character(),
  tableAncestors = NULL,
  verbose = FALSE
)

Value

a list of integer vectors.

Arguments

tree

a phylo object with set labels for the internal nodes

minCladeSize

integer indicating the minimum number of tips allowed in one part.

skipNodes

an integer or character vector indicating the ids or labels of nodes that should not be used as partition nodes. By default, this is an empty character vector.

tableAncestors

NULL (default) or an integer matrix returned by a previous call to PCMTreeTableAncestors(tree).

verbose

a logical indicating if informative messages should be printed to the console.

Examples

Run this code

set.seed(1, kind = "Mersenne-Twister", normal.kind = "Inversion")
tree <- PCMTree(ape::rtree(10))

if(requireNamespace("ggtree"))
PCMTreePlot(tree) + ggtree::geom_nodelab() + ggtree::geom_tiplab()

# list of all partitions into parts of at least 4 tips
PCMTreeListAllPartitions(tree, 4)

# list of all partitions into parts of at least 3 tips
PCMTreeListAllPartitions(tree, 3)

# list all partitions into parts of at least 3 tips, excluding the partitions
# where node 16 is one of the partition nodes:
PCMTreeListAllPartitions(tree, minCladeSize = 3, skipNodes = "16")

Run the code above in your browser using DataLab