Turn a newick format tree to a matrix of edges
newick_to_edges(newick, node = "R", edgemat = matrix(NA, 0, 2))
Tree in newick format.
Root label of the tree.
Used for recursive function calls.
Tree as two column matrix of edges (adjacency list)
newick = random_newick(c('a', 'b', 'c', 'd'))
newick
#> [1] "(a,((b,c),d))"
newick_to_edges(newick)
#> [,1] [,2]
#> [1,] "R" "a"
#> [2,] "R" "Rr"
#> [3,] "Rr" "Rrl"
#> [4,] "Rrl" "b"
#> [5,] "Rrl" "c"
#> [6,] "Rr" "d"