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.
dcTreeConnectivity(phy, verbose = T)
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.
None
# 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)The connectivity for 5 internal nodes X 11 tips+internal nodesdim(res)[1] 5 11# convert to a full Matrix as.matrix(res)1 2 3 4 5 6 7 8 9 10 11 7 1 1 1 1 1 1 0 1 1 1 1 8 1 1 1 1 0 0 0 0 1 1 0 9 1 1 0 0 0 0 0 0 0 0 0 10 0 0 1 1 0 0 0 0 0 0 0 11 0 0 0 0 1 1 0 0 0 0 0
dcTreeConnectivity.r
dcTreeConnectivity.Rd
dcTreeConnectivity.pdf
dcTreeConnectivity