simulate_bipartite_network: Simulate a bipartite network

View source: R/network_formats.R

simulate_bipartite_networkR Documentation

Simulate a bipartite network

Description

Simulate a bipartite network

Usage

simulate_bipartite_network(
  actors,
  events,
  edges = NULL,
  probability = 0.1,
  weight = c("binary", "uniform", "normal", "poisson"),
  weight_mean = 1,
  weight_sd = 1,
  weight_range = c(0.1, 1),
  seed = NULL,
  batch = NULL
)

Arguments

actors

Number or labels of primary-mode nodes.

events

Number or labels of secondary-mode nodes.

edges

Optional exact number of cross-mode edges.

probability

Cross-mode edge probability when edges is NULL.

weight

Edge-weight distribution.

weight_mean, weight_sd, weight_range

Weight parameters.

seed

Optional seed.

batch

Optional single positive whole number. When given, the simulator runs batch times and returns a plain list of batch results, each exactly what the same call without batch returns. With a seed, every dataset gets its own seed drawn from seed, so the whole batch is reproducible; without one the datasets are consecutive draws from the session's random-number stream. The default NULL returns a single result.

Value

A tidy cross-mode edge-list simulab_sim base data.frame with one row per actor-event edge and columns from (always an actor), to (always an event), weight, from_mode, and to_mode. The two modes are disjoint, so no edge joins two actors or two events and self-loops cannot occur. as.data.frame(x, what = ) also returns nodes (node, mode), incidence (the wide actor-by-event incidence table: an actor column followed by one column per event), and a one-row settings table.

Examples

result <- simulate_bipartite_network(actors = 20, events = 6, probability = 0.3, seed = 1)
head(result)
components(result)

simulab documentation built on Oct. 15, 2026, 5:08 p.m.