simulate_graph: Simulate Independent Switching Graph

View source: R/simulate_graph.R

simulate_graphR Documentation

Simulate Independent Switching Graph

Description

Useful for those interested primarily in generating modular network graphs. Equivalent to using simulate_schedule with the independent simulator and then graph_from_schedule, but also includes a discrete-time approximation that is faster for large networks.

Usage

simulate_graph(
  n_animals,
  n_groups,
  time_to_leave,
  time_to_return,
  travel_time,
  sampling_duration,
  sampler = "discrete",
  samples_per_day = 1
)

Arguments

n_animals

The number of nodes to include in the network.

n_groups

The number of modules in the network.

time_to_leave

The average days spent within the home group prior to leaving.

time_to_return

The average days spent abroad before returning to home group.

travel_time

Vector of the range of values that travel to the next group can take, drawn from a uniform distribution.

sampling_duration

The number of days to simulate.

sampler

Takes one of c("discrete", "continuous"). Whether group composition should be monitored instantaneously (truth), or sampled in discrete time.

samples_per_day

Only used in discrete time approximations in simulate_graph.

Value

sim_igraph, an igraph graph object.

See Also

plot_simulated_graph

Examples

g <- simulate_graph(n_animals = 10,
                    n_groups = 2,
                    time_to_leave = 5,
                    time_to_return = 2,
                    travel_time = c(0.001,0.2),
                    sampling_duration = 7,
                    sampler = "discrete",
                    samples_per_day = 1
                    )

gavincotterill/modulr documentation built on Nov. 30, 2022, 11:15 p.m.