Dynamics#

raphtory.algorithms.temporal_SEIR(graph, seeds, infection_prob, initial_infection, recovery_rate=None, incubation_rate=None, rng_seed=None)#

Simulate an SEIR dynamic on the network

The algorithm uses the event-based sampling strategy from https://doi.org/10.1371/journal.pone.0246961

Parameters:
  • graph (GraphView) – the graph view

  • seeds (int | float | list[Node]) – the seeding strategy to use for the initial infection (if int, choose fixed number of nodes at random, if float infect each node with this probability, if [Node] initially infect the specified nodes

  • infection_prob (float) – the probability for a contact between infected and susceptible nodes to lead to a transmission

  • initial_infection (int | str | DateTime) – the time of the initial infection

  • recovery_rate (float | None) – optional recovery rate (if None, simulates SEI dynamic where nodes never recover) the actual recovery time is sampled from an exponential distribution with this rate

  • incubation_rate (float | None) – optional incubation rate (if None, simulates SI or SIR dynamics where infected nodes are infectious at the next time step) the actual incubation time is sampled from an exponential distribution with this rate

  • rng_seed (int | None) – optional seed for the random number generator

Returns:

Returns an Infected object for each infected node with attributes

infected: the time stamp of the infection event

active: the time stamp at which the node actively starts spreading the infection (i.e., the end of the incubation period)

recovered: the time stamp at which the node recovered (i.e., stopped spreading the infection)

Return type:

AlgorithmResult[Infected]