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

node_status error #33

Closed debmalya191 closed 5 years ago

debmalya191 commented 5 years ago

I have a graph G=nx.grid_2d_graph(m,m,periodic=True). When I try to run -

G=nx.grid_2d_graph(m,m,periodic=True) initial_infections = [(u,v) for (u,v) in G if u==int(m/2) and v==int(m/2)] sim = EoN.basic_discrete_SIR(G,0.5,initial_infecteds = initial_infections, return_full_data=True, tmax = 25) print(EoN.Simulation_Investigation.node_status(G,(0,0),1))

it gives the error-

print(EoN.Simulation_Investigation.node_status(G,(0,0),1))

File "D:\anaconda\lib\site-packages\EoN\simulation_investigation.py", line 108, in node_status changetimes = self._nodehistory[node][0] AttributeError: 'Graph' object has no attribute '_nodehistory'

joelmiller commented 5 years ago

Thanks for the report.

Instead of print(EoN.Simulation_Investigation.node_status(G,(0,0),1)), use print(sim.node_status((0,0),1)) to get the status of node (0,0) at time 1.

The sim object you created above has all of the information about the simulation you did.

(note, I'll be traveling later this week and next so I'll be slow to respond if you have more support requests).