Description Usage Arguments Value See Also Examples

Given an admixture graph, selects an edge and branches off a new edge ending at a new leaf.

1 | ```
add_a_leaf(graph, leaf_name, outgroup = "")
``` |

`graph` |
An admixture graph. |

`leaf_name` |
A name for the new leaf. |

`outgroup` |
An optional parameter for the preferred outgroup, which can be the new leaf. |

A list of graphs made by adding a new leaf to the input graph. The list has no duplicate elements.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ```
# Take a look at how much trees there are:
leaves <- c("1", "2")
inner_nodes <- c("R")
edges <- parent_edges(c(edge("1", "R"), edge("2", "R")))
admixtures <- NULL
Lambda <- agraph(leaves, inner_nodes, edges, admixtures)
set <- list(Lambda)
for (i in seq(1, 6)) {
new_set <- list()
for (tree in set) {
new_set <- c(new_set, add_a_leaf(tree, paste(i + 2)))
}
set <- new_set
cat("There are ")
cat(length(set))
cat(" different trees with ")
cat(i + 2)
cat(" labeled leaves.")
cat("\n")
}
# In general, there are 1*3*5*...*(2n - 5) different trees with n labeled leaves
# (A001147 in the online encyclopedia of integer sequences).
# Exhaustive search through the graph space is hard!
``` |

mailund/admixture_graph documentation built on April 3, 2018, 9:28 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.