EoN.fast_nonMarkov_SIS¶
-
EoN.
fast_nonMarkov_SIS
(G, trans_time_fxn=None, rec_time_fxn=None, trans_and_rec_time_fxn=None, trans_time_args=(), rec_time_args=(), trans_and_rec_time_args=(), initial_infecteds=None, rho=None, tmin=0, tmax=100, return_full_data=False, sim_kwargs=None)[source]¶ Similar to fast_nonMarkov_SIR.
Warning: trans_time_fxn (or trans_and_rec_time_fxn) need to return lists of times. Not just the next time. So this is different from the SIR version.
Arguments: - G networkx Graph
- The underlying network
trans_time_fxn User-defined function returning a list
RETURNS A LIST
has slightly different arguments than the SIR version
a user-defined function that returns list of delays until transmission for an edge. All delays are before recovery.
Each entry is the delay from time of infection of node to time of the given transmission (i.e., it’s not looking at delays from one transmission to the next)
May depend on various arguments and need not be Markovian.
Called using the form
trans_delays = trans_time_fxn(source_node, target_node, rec_delay, *trans_time_args)
the source_node is the infected node
the target_node is the node that may receive transmission
rec_time_fxn user-designed function returning a float
Returns the duration of infection of a node. May depend on various arguments and need not be Markovian.
Called using the form
duration = rec_time_fxn(node, *rec_time_args)
trans_and_rec_time_fxn user-defined function returning a dict and a float
returns both a dict whose values are lists of delays until transmissions for all edges from source to neighbors and a float giving duration of infection of the source.
can only be used instead of
trans_time_fxn
andrec_time_fxn
. there is an error if these are also defined.Called using the form
trans_delay_dict, duration = trans_and_rec_time_fxn(node, susceptible_neighbors, *trans_and_rec_time_args)
here
trans_delay_dict is a dict whose keys are those neighbors who receive a transmission and whose values are lists of delays
duration is a float.
- trans_time_args tuple
- see trans_time_fxn
- rec_time_args tuple
- see rec_time_fxn
- trans_and_rec_time_args tuple
- see trans_and_rec_time_fxn
- initial_infecteds node or iterable of nodes
- 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 number
- initial fraction infected. number is int(round(G.order()*rho))
- tmin number (default 0)
- starting time
- tmax number (default 100)
- stop time
- return_full_data boolean (default False)
- Tells whether a Simulation_Investigation object should be returned.
- sim_kwargs keyword arguments
- Any keyword arguments to be sent to the Simulation_Investigation object
Only relevant if
return_full_data=True
Returns: - times, S, I each a numpy array
- giving times and number in each status for corresponding time
or if return_full_data=True:
- full_data a Simulation_Investigation object
- from this we can extract the status history of all nodes We can also plot the network at given times and even create animations using class methods.
SAMPLE USE: