randomGraph | R Documentation |
A function for generating a random directed graph.
randomGraph(
NV,
NC,
NP,
timestep,
maxDist,
...,
mean = c("arithmetic", "geometric", "harmonic"),
weighting = invDistWeighting,
verbose = TRUE,
saveDist = TRUE
)
NV |
An integer. The number of vertices to generate. |
NC |
A function with a |
NP |
A function with a |
timestep |
A function with a |
maxDist |
A function with a |
... |
Any arguments to be passed internally to the functions given as
arguments |
mean |
One of character strings |
weighting |
A weighting function; it takes a set of distances as its
first argument and returns a set of weights summing to |
verbose |
A Boolean. Whether or not to print messages associated with
the graph simulation process (default: |
saveDist |
A Boolean. Whether or not to save the graph distance matrix
as an attribute to the returned |
Details contents...
A graph-class
object.
Guillaume Guénard [aut, cre] (<https://orcid.org/0000-0003-0761-3072>), Pierre Legendre [ctb] (<https://orcid.org/0000-0002-3838-3305>) Maintainer: Guillaume Guénard <guillaume.guenard@umontreal.ca>
graph-class
.
## Setting the RNG seed to obtain consistent examples:
set.seed(2182955)
## A linear evolutionary sequence with random edge lengths between 2 and 5:
randomGraph(
NV = 100,
NC = function(...) 1,
NP = function(...) 1,
timestep = function(ts_min, ts_max, ...) runif(1, ts_min, ts_max),
maxDist = function(...) NULL,
ts_min = 2,
ts_max = 5
)
## As above, but allowing for dichotomic splitting.
randomGraph(
NV = 100,
NC = function(...) 2,
NP = function(...) 1,
timestep = function(ts_min, ts_max, ...) runif(1, ts_min, ts_max),
maxDist = function(...) NULL,
ts_min = 2,
ts_max = 5
)
## A random evolutionary graph with random numbers of children and parents per
## node, random time steps, and a random maximum distance between the parents:
randomGraph(
NV = 250,
NC = function(lambda_child, ...) 1 + rpois(1, lambda_child),
NP = function(lambda_parent, ...) 1 + rpois(1, lambda_parent),
timestep = function(ts_min, ts_max, ...) runif(1, ts_min, ts_max),
maxDist = function(max_anc, ...) runif(1, 0, max_anc),
lambda_child = 2.5,
lambda_parent = 4,
ts_min = 2,
ts_max = 5,
max_anc = 4
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.