# add_a_leaf: Adds a new leaf to a graph. In mailund/admixture_graph: Admixture Graph Manipulation and Fitting

## Description

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

## Usage

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

## Arguments

 `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.

## Value

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

`all_graphs`

`fit_permutations_and_graphs`

`fit_graph_list`

`add_an_admixture`

`add_an_admixture2`

`make_an_outgroup`

## Examples

 ``` 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.