EoN.estimate_nonMarkov_SIR_prob_size_with_timing(G, trans_time_fxn, rec_time_fxn, trans_time_args=(), rec_time_args=())[source]

estimates probability and size for user-input transmission and recovery time functions.

G Networkx Graph
the input graph
trans_time_fxn function
trans_time_fxn(u, v, *trans_time_args) returns the delay from u’s infection to transmission to v.
rec_time_fxn function
rec_time_fxn(u, *rec_time_args) returns the delay from u’s infection to its recovery.
trans_time_args tuple
any additional arguments required by trans_time_fxn. For example weights of nodes.
rec_time_args tuple
any additional arguments required by rec_time_fxn
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
#equivalent to
#PE, AR = EoN.estimate_SIR_prob_size(G, tau, gamma)

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


tau = 2

gamma = 1

def trans_time_fxn(u,v, tau):

    return random.expovariate(tau)

def rec_time_fxn(u, gamma):

    return random.expovariate(gamma)

PE, AR = EoN.estimate_nonMarkov_SIR_prob_size(G,
                                            rec_time_fxn = rec_time_fxn,
                                            trans_time_args = (tau,),
                                            rec_time_args = (gamma,)