Converts a tree given as lists of children to the Newick tree format

childList2nwk(list, n)

Arguments

list

A list. the list of children of tree.

n

A single integer. The number of mutations.

Value

the string of newick format tree.

Examples

p = c(11, 2, 3, 14, 14, 16, 8, 6, 9, 1, 15, 8, 10, 14, 5, 13, 17)
cl = getChildListFromParentVector(p,16)
childList2nwk(list = cl,n = 16)
#> [1] "(((((((((8)7,(1)12)9)10)2)3)4,5,(((13)11)16)14)15)6)17;"