EoN.SIS_heterogeneous_pairwise_from_graph(G, tau, gamma, initial_infecteds=None, rho=None, tmin=0, tmax=100, tcount=1001, return_full_data=False)[source]

Calls SIS_heterogeneous_pairwise after calculating Sk0, Ik0, SkSl0, SkIl0, IkIl0 from a graph G and initial fraction infected rho.

G networkx Graph
The contact network
tau positive float
transmission rate
gamma number
recovery rate
initial infecteds node or iterable of nodes (default None)
if a single node, then this node is initially infected if an iterable, then whole set is initially infected if None, then choose randomly based on rho. If rho is also None, a random single node is chosen. If both initial_infecteds and rho are assigned, then there is an error.
rho float between 0 and 1 (default None)
the fraction to be randomly infected at time 0 If None, then rho=1/N is used where N = G.order()
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)
tells whether to just return times, S, I, or all calculated data. if True, then returns times, S, I, SI, SS
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
import networkx as nx
import EoN
G = nx.fast_gnp_random_graph(10000,0.0005)
tau = 1
gamma = 3
rho = 0.02
t, S, I = EoN.SIS_heterogeneous_pairwise_from_graph(G, tau, gamma, rho, tmax = 20)
This can have segmentation faults if there are too many degrees in the
graph.  This appears to happen because of trouble in numpy, and I have
not been able to find a way around it.