EoN.SIS_heterogeneous_pairwise¶
-
EoN.
SIS_heterogeneous_pairwise
(Sk0, Ik0, SkSl0, SkIl0, IkIl0, tau, gamma, tmin=0, tmax=100, tcount=1001, return_full_data=False, Ks=None)[source]¶ Encodes System (5.13) of Kiss, Miller, & Simon. Please cite the book if using this algorithm.
In the text this is often referred to as the heterogeneous mean-field model closed at the level of triples
Arguments: - Sk0 array.
(if Ks is defined, the definition changes slightly, see below)
Sk0[k] is the number of nodes that are susceptible and have degree k. If one is empty, it becomes 0.
- Ik0 array
(if Ks is defined, the definition changes slightly, see below)
similar to Sk0, but for infected.
- SkSl0 2D numpy array
(if Ks is defined, the definition changes slightly, see below)
SkSl0[k][l] is [S_kS_l] at 0 see below for constraints these should satisfy related to Sk0 and Ik0. The code does not enforce these constraints.
- SkIl0 2D numpy array
- as in SkSl0
- IkIl0 2D numpy array
- as in SkSl0
- tau positive float
- transmission rate
- gamma number
- recovery rate
- tmin number (default 0)
- minimum report time
- tmax number (default 100)
- maximum report time
- tcount integer (default 1001)
- number of reports
- return_full_data boolean (default False)
- If True, return times, Sk, Ik, SkIl, SkSl, IkIl If False, return times, S, I
- Ks numpy array. (default
None
) - (helps prevent memory errors) if some degrees are not observed, then the corresponding entries of these arrays are zero. This can lead to memory errors in the case of a network with many missing degrees. So Ks is an (assumed) ordered vector stating which Ks are actually observed. Then the Sk0[i] is the number of nodes that are susceptible and have degree Ks[i]. Similarly for Ik0 and SkIl0 etc.
In principle, there are constraints relating Sk with SkSl and SkIl and similarly relating Ik with IkIl and SkIl.T.
No attempt is made to enforce these.
It is assumed the user will ensure acceptible inputs.
We could also remove Sk0 and Ik0 as inputs and infer them from the others, but for consistency with elsewhere, this is not done here.
Returns: - if return_full_data is True:
- returns times, S, I, Sk, Ik, SkIl, SkSl, IkIl
- if return_full_data is False:
- returns times, S, I
SAMPLE USE: import networkx as nx import EoN import numpy as np Sk0 = 100 * np.ones(4) Ik0 = np.zeros(4) Ik0[3]=1 SkSl0 = np.array([[0, 0,0,0],[0,100,0,0],[0,0,200,0],[0,0,0,294]]) #only interact within a degree class, so the deg 1 and 2 are safe. SkIl0 = np.zeros((4,4)) SkIl0[3,3] = 3 IkIl0 = np.zeros((4,4)) tau = 1 gamma = 1 t, S, I = EoN.SIS_heterogeneous_pairwise(Sk0, Ik0, SkSl0, SkIl0, IkIl0, tau, gamma)