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:
- Each node
ibecomes active with probabilityactivity_rates[i]. - 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 nodesn_steps– number of discrete time stepsactivity_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].