dcTreeConnectivity: Function to calculate the sparse connectivity matrix between...

View source: R/dcTreeConnectivity.r

dcTreeConnectivityR Documentation

Function to calculate the sparse connectivity matrix between parents and children from a phylo-formatted phylogenetic tree

Description

dcTreeConnectivity is supposed to calculate the sparse connectivity matrix between parents and children from a phylo-formatted phylogenetic tree. The matrix has internal nodes (in rows) and tips plus internal nodes (in columns). For a row (an internal node; as a parent), the non-zeros indicate all its descendants/children.

Usage

dcTreeConnectivity(phy, verbose = T)

Arguments

phy

an object of class 'phylo'

verbose

logical to indicate whether the messages will be displayed in the screen. By default, it sets to TRUE for display

Value

a sparse matrix of Nnode X Ntip+Nnode, where Ntip and Nnode are the number of tips and internal nodes. A non-zero entry indicates a pair of a parent and its child.

Note

None

See Also

dcTreeConnectivity

Examples

# a newick tree
tree <- "(((t1:5,t2:5):2,(t3:4,t4:4):3):2,(t5:4,t6:4):6);"
phy <- ape::read.tree(text=tree)

# connectivity matrix
res <- dcTreeConnectivity(phy)
dim(res)
# convert to a full Matrix
as.matrix(res)

hfang-bristol/dcGOR documentation built on July 16, 2022, 6:43 p.m.