# EoN.estimate_nonMarkov_SIR_prob_size¶

EoN.estimate_nonMarkov_SIR_prob_size(G, xi, zeta, transmission)[source]

Predicts epidemic probability and size using nonMarkov_directed_percolate_network.

This is not directly described in Kiss, Miller, & Simon, but is based on (fig 6.18).

You probably DON’T REALLY WANT TO USE THIS. Check if estimate_nonMarkov_prob_size_with_timing fits your needs better.

G (networkx Graph)
The input graph
xi dict
xi[u] gives all necessary information to determine what u’s infectiousness is.
zeta dict
zeta[v] gives everything needed about v’s susceptibility
transmission user-defined function
transmission(xi[u], zeta[v]) determines whether u transmits to v. Returns True or False depending on whether the transmission would happen
PE, AR numbers (between 0 and 1)
Estimates of epidemic probability and attack rate found by finding largest strongly connected component and finding in/out components.
#mimicking the standard version with transmission rate tau
#and recovery rate gamma

import networkx as nx
import EoN
import random
from collections import defaultdict

G=nx.fast_gnp_random_graph(1000,0.002)
tau = 2
gamma = 1

xi = {node:random.expovariate(gamma) for node in G.nodes()}
#xi[node] is duration of infection of node.

zeta = defaultdict(lambda : tau) #every node has zeta=tau, so same
#transmission rate

def my_transmission(infection_duration, trans_rate):
#infect if duration is longer than time to infection.
if infection_duration > random.expovariate(trans_rate):
return True
else:
return False

PE, AR = EoN.estimate_nonMarkov_SIR_prob_size(G, xi, zeta,
my_transmission)