EoN.directed_percolate_network¶
- EoN.directed_percolate_network(G, tau, gamma, weights=True, *, rng=None)[source]¶
performs directed percolation, assuming that transmission and recovery are Markovian
From figure 6.13 of Kiss, Miller, & Simon. Please cite the book if using this algorithm.
This performs directed percolation corresponding to an SIR epidemic assuming that transmission is at rate tau and recovery at rate gamma
- See Also:
nonMarkov_directed_percolate_networkwhich allows for duration andtime to infect to come from other distributions.
nonMarkov_directed_percolate_networkwhich allows for more complexrules
- Arguments:
- G networkx Graph
The network the disease will transmit through.
- tau positive float
transmission rate
- gamma positive float
recovery rate
- weights boolean (default True)
if True, then includes information on time to recovery and delay to transmission. If False, just the directed graph.
- rng random number generator
If None, will be set to np.random.default_rng()
- Returns:
:
- H networkx DiGraph (directed graph)
a u->v edge exists in H if u would transmit to v if ever infected.
The edge has a time attribute (time_to_infect) which gives the delay from infection of u until transmission occurs.
Each node u has a time attribute (duration) which gives the duration of its infectious period.
- SAMPLE USE:
import networkx as nx import EoN G = nx.fast_gnp_random_graph(1000,0.002) H = EoN.directed_percolate_network(G, 2, 1)