# 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)
Run the code above in your browser using DataLab