Skip to main content

activity_driven_model

Function activity_driven_model 

Source
pub fn activity_driven_model<R: Rng>(
    n_nodes: usize,
    n_steps: usize,
    activity_rates: &[f64],
    rng: &mut R,
) -> Result<TemporalGraph>
Expand description

Generate a synthetic temporal graph using the Activity-Driven Model (Perra et al. 2012).

At each discrete step t = 0, 1, …, n_steps - 1:

  1. Each node i becomes active with probability activity_rates[i].
  2. Each active node creates one undirected contact with a uniformly chosen partner (self-loops excluded).

The resulting graph is stored as a sorted stream of TemporalEdge contacts with timestamp = t as f64.

§Arguments

  • n_nodes – number of nodes
  • n_steps – number of discrete time steps
  • activity_rates – activity probability for each node (values in [0,1])
  • rng – seeded random number generator

§Errors

Returns GraphError::InvalidGraph if activity_rates.len() != n_nodes or any activity rate is outside [0, 1].