springer-math / Mathematics-of-Epidemics-on-Networks

Source code accompanying 'Mathematics of Epidemics on Networks' by Kiss, Miller, and Simon http://www.springer.com/us/book/9783319508047 . Documentation for the software package is at https://epidemicsonnetworks.readthedocs.io/en/latest/
MIT License
151 stars 61 forks source link

how to get the node state by EoN? #81

Closed King-1991 closed 2 years ago

King-1991 commented 2 years ago

Hi, Now I need to obtain the individuals' state at random steps. But I find the EoN only returns the number of each state and their time. So how to do that? Thank you and looking forward to your reply.

joelmiller commented 2 years ago

By default that is what EoN returns. But there is a flag return_full_data which is set to False by default. If you set it to true, the return value changes. You get a simulation_investigation object. A description of some of the things you can do with that is here: https://epidemicsonnetworks.readthedocs.io/en/latest/EoN.html#simulation-investigation-toolkit

joelmiller commented 2 years ago

For example:

sim = EoN.fast_SIR(G,1,2,return_full_data=True)
sim.node_status(1,4.5)

will give you the status of node 1 at time 4.5. However

sim.node_history(1)

will give you the history of node 1 (times of transitions and what those new statuses are). This is more interesting in SIS disease or more complicated processes.