tapios / risk-networks

Code for risk networks: a blend of compartmental models, graphs, data assimilation and semi-supervised learning
Other
2 stars 2 forks source link

KeyError in in Gillespie_simple_contagion #60

Closed glwagner closed 4 years ago

glwagner commented 4 years ago

@lubo93 reports that this script:

https://github.com/dburov190/risk-networks/blob/bbae6b881f05a887e8c3cc5c8924e76be79043fa/examples/simulate_simple_epidemic_NYC.py

produces a KeyError that comes from Gillespie_simple_contagion:

glwagner commented 4 years ago

As discussed on #58, the problem appears to be that the node numbers of the contact network are not a simple range. The contact network is missing node 6130; as a result, while the network has 10017 nodes, the last node in the network has id 10017 (rather than 10016). This results in a the KeyError above.

lubo93 commented 4 years ago

Solved by using contact_network = nx.convert_node_labels_to_integers(contact_network) or using node numbers that are given by a simple range.