EoN.SIR_pair_based

EoN.SIR_pair_based(G, tau, gamma, rho=None, nodelist=None, Y0=None, X0=None, XY0=None, XX0=None, tmin=0, tmax=100, tcount=1001, transmission_weight=None, recovery_weight=None, return_full_data=False)[source]

Encodes System (3.39) of Kiss, Miller, & Simon. Please cite the book if using this algorithm.

WARNING This does not solve the pairwise equations. Look at SIR_homogeneous_pairwise and SIR_heterogeneous_pairwise for that.

This system solves equations for an SIR disease model spreading on a given graph. It captures the dependence with pairs, but not triples.

It will be exact for a tree.

There are NO CORRECTIONS for the existence of TRIANGLES or any other CYCLES.

Some corrections for triangles are provided in the text, but not implemented here.

See also: Hadjichrysanthou and Sharkey Epidemic control analysis: Desigining targeted intervention

strategies against epidemics propagated on contact networks,

Journal of Theoretical Biology

Arguments:

G networkx Graph

tau positive float

transmission rate of disease

gamma number

global recovery rate

rho float between 0 and 1 (default None)

proportion assumed initially infected. If None, then Y0 is used if Y0 is also None, then rho = 1./N

nodelist list

list of nodes in G in the some prescribed order (just since there is no guarantee that G returns nodes in the same order if things change a bit.)

Y0 numpy array

the array of initial infection probabilities for each node in order as in nodelist/

X0 numpy array (default None)

probability a random node is initially susceptible. the probability of initially recovered will be 1-X0-Y0. By default we assume no initial recoveries, so X0=1-Y0 will be assumed unless both Y0 and X0 are given.

XY0 2D numpy array (default None)

(each dimension has length number of nodes of G) XY0[i,j] is probability node i is susceptible and j is

infected.

if None, then assumes that infections are introduced

randomly according to Y0.

XX0 2D numpy array (default None)

(each dimension has length number of nodes of G) XX0[i,j] is probability nodes i and j are susceptible. if None, then assumes that infections are introduced

randomly according to Y0.

tmin number (default 0)

minimum report time

tmax number (default 100)

maximum report time

tcount integer (default 1001)

number of reports

transmission_weight string

the label for a weight given to the edges. G.edge[i][j][transmission_weight] = g_{ij}

recovery_weight string (default None)

a label for a weight given to the nodes to scale their recovery rates

gamma_i = G.nodes[i][recovery_weight]*gamma

return_full_data boolean (default False)
if True:

returns times, S, I, R, Xs, Ys, Zs, XY, XX

if False:

returns times, S, I, R

Returns:

if return_full_data is True:

returns times, S, I, R, Xs, Ys, Zs, XY, XX

if … is False:

returns times, S, I, R

SAMPLE USE:

import networkx as nx
import EoN

G = nx.fast_gnp_random_graph(1000,0.004)
nodelist = G.nodes()
Y0 = np.array([1 if node<10 else 0 for node in nodelist]) #infect first 10
t, S, I, R = EoN.SIR_pair_based(G, nodelist, Y0, 2, 0.5, tmax = 4, tcount = 101)
plt.plot(t,I)