EoN.fast_simple_contagion¶
- EoN.fast_simple_contagion(G, spontaneous_transition_graph, nbr_induced_transition_graph, IC, return_statuses, tmin=0, tmax=100, spont_kwargs=None, nbr_kwargs=None, *, rng=None, return_full_data=False, sim_kwargs=None)[source]¶
Event-driven simulation for Markovian simple contagions on networks.
This is an event-driven analogue of Gillespie_simple_contagion. It uses the existing myQueue priority queue, following the same general approach as fast_SIR and fast_SIS.
See Gillespie_simple_contagion for explanation of arguments
- This supports:
spontaneous transitions A -> B
neighbor-induced transitions (A, B) -> (A, C)
In a neighbor-induced transition, only the second node changes status.
This version uses two stale-event safeguards:
- node_version:
Each node has a version number that increments whenever the node changes status. Queued events store the source and target versions at the time the event was scheduled. If either version has changed by the time the event fires, the event is stale and is ignored.
- scheduled_exit_time:
Each node stores the currently scheduled time at which it will leave its present status by a spontaneous transition. When scheduling a neighbor-induced event from source to target, we only add it to the queue if it occurs before source leaves its present status. This avoids adding many events that are guaranteed to become stale.
Because node_version handles correctness, this function does not require infectious statuses to be immune.
This function intentionally does not include policy_function. A global policy function that rescales rates based on the whole system state is not compatible with independently scheduled local exponential clocks.