Simulate a tidy network edge list
Arguments
- nodes
Number of nodes or unique node labels.
- edges
Optional exact number of edges.
- probability
Edge probability when
edgesisNULL.- directed
Generate directed edges.
- loops
Permit self-loops.
- weight
Edge-weight distribution.
- weight_mean, weight_sd, weight_range
Weight parameters.
- node_type
Optional node type for each node.
- edge_classes
Optional number or labels of edge classes.
- class_probabilities
Optional edge-class probabilities.
- seed
Optional seed.
- batch
Optional single positive whole number. When given, the simulator runs
batchtimes and returns a plainlistofbatchresults, each exactly what the same call withoutbatchreturns. With aseed, every dataset gets its own seed drawn fromseed, so the whole batch is reproducible; without one the datasets are consecutive draws from the session's random-number stream. The defaultNULLreturns a single result.
Value
A tidy simulab_sim base data.frame with one row per edge and
columns from, to, and weight (plus edge_class when edge_classes
is supplied). as.data.frame(x, what = ) also returns nodes
(node, type), adjacency (a long row/column/weight table over
all ordered node pairs), and a one-row settings table.
Examples
result <- simulate_edge_list(nodes = 40, probability = 0.08, seed = 1)
head(result)
#> <simulab_sim:edge_list> 6 rows x 3 columns
#> from to weight
#> 1 8 1 1
#> 2 19 1 1
#> 3 22 1 1
#> 4 2 3 1
#> 5 27 3 1
#> 6 32 3 1
#>
#> Truth (settings):
#> model directed loops weight nodes edges
#> 1 bernoulli TRUE FALSE binary 40 138
#>
#> Other tables: nodes, adjacency. Read one with as.data.frame(x, what = "nodes").
components(result)
#> table rows columns
#> 1 data 138 3
#> 2 nodes 40 2
#> 3 adjacency 1600 3
#> 4 settings 1 6