Generate a random binary graph

random_newick(n, start = "", end = "", outpop = NULL)

Arguments

n

The number of terminal nodes, or a vector of population labels.

start

Prefix.

end

Postfix.

outpop

Outgroup (if n is a vector of labels).

Value

Tree in newick format.

Examples

random_newick(5)
#> [1] "((,(,(,))),)"
random_newick(c('a', 'b', 'c', 'd')) # toplogy random, but pop order fixed
#> [1] "(a,(b,(c,d)))"
random_newick(sample(c('a', 'b', 'c', 'd'))) # toplogy and pop order random
#> [1] "((a,c),(b,d))"