This function assigns a date (in generations) to each node in an admixture graph and is used in random_sim. The dates are drawn from a uniform distribution with given lower and upper bounds, unless the fix_leaf option is set to TRUE, in which case the dates of all leaf nodes returned by get_leafnames will be set to 0.

random_dates(graph, min = 1000, max = 1000, fix_leaf = FALSE)

Arguments

graph

An admixture graph

min

A lower limit of uniform distribution

max

An upper limit of uniform distribution

fix_leaf

A boolean specifying if the dates of the leaf nodes will be fixed at time 0 (i.e., at the most recent time). If TRUE, all samples will be drawn at the end of the simulation (i.e., from "today"). The default is FALSE.

Value

A named vector with random dates for each graph node