Draws a random undirected graph on p nodes from one of the available
structure generators, rejecting degenerate draws (the empty graph and the
complete graph) and resampling until a usable structure is obtained. The
returned adjacency matrix is what simulate_prior_study uses for simulating
prior study parameters.
Usage
generate_graph(
p,
structure = c("smallworld", "random", "scalefree", "Bernoulli"),
...,
max_attempts = 1000L
)Arguments
- p
Number of nodes (variables) in the graph. Must be at least 3.
- structure
Which graph generator to use:
"smallworld","random","scalefree"or"Bernoulli".- ...
Further arguments passed to the graph generator. The
"Bernoulli"structure requiresprob, the edge-inclusion probability in \((0, 1)\). The other structures take no extra arguments.- max_attempts
Maximum number of rejection-sampling draws before giving up with an error. Guards against parameter choices for which a non-degenerate graph is effectively unreachable.