Description Usage Arguments Details Value Examples
View source: R/zero_est_graph.R
Randomly generates DAGs of specified sparsity.
1 | rand_init_dags(m, init_spars, init_eachs)
|
m |
An integer, the number of nodes. |
init_spars |
A vector of numbers between 0 and 1, inclusive. It is assumed that |
init_eachs |
A positive integer or a vector of positive integers of the same length as |
Randomly generates DAGs of specified sparsity.
For each spar
in init_spars
, the function generates a complete graph, then randomly remove as.integer(m*(m-1)/2*(1-spar))
edges. Finally, the ordering of the m
nodes are randomized.
For each spar = init_spars[i]
this is repeated init_eachs
(if integer) or init_eachs[i]
(if init_eachs
is a vector of integers) times; duplicate graphs are avoided and at most 200 attempts will be made when generating each new graph.
Note that for spar = 0
there will only be one empty graph returned.
A list of adjacency matrices each of shape m
by m
.
1 2 | rand_init_dags(4, c(0, 0.25, 0.5, 0.75, 1), 5)
rand_init_dags(10, c(0, 0.25, 0.5, 0.75, 1), 5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.