You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I run the tutorial code of ICEmodel. And it produces the error code:
0%| | 1/200 [00:00<00:00, 853.37it/s]
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-17-42574a55ef61> in <module>
22
23 # Simulation execution
---> 24 iterations = model.iteration_bunch(200)
~/anaconda3/lib/python3.7/site-packages/ndlib/models/DiffusionModel.py in iteration_bunch(self, bunch_size, node_status)
199 system_status = []
200 for it in tqdm.tqdm(past.builtins.xrange(0, bunch_size)):
--> 201 its = self.iteration(node_status)
202 system_status.append(its)
203 return system_status
~/anaconda3/lib/python3.7/site-packages/ndlib/models/epidemics/ICPModel.py in iteration(self, node_status)
84 key = (u, v)
85
---> 86 if self.params['nodes']['com'][u] == self.params['nodes']['com'][v]: # within same community
87 # Individual specified thresholds
88 if 'threshold' in self.params['edges']:
KeyError: 'com'
To Reproduce
The tutorial code I run:
import networkx as nx
import ndlib.models.ModelConfig as mc
import ndlib.models.epidemics as ep
g = nx.erdos_renyi_graph(1000, 0.1)
# Model selection
model = ep.ICPModel(g)
# Model Configuration
config = mc.Configuration()
config.add_model_parameter('fraction_infected', 0.1)
config.add_model_parameter('permeability', 0.3)
# Setting the edge parameters
threshold = 0.1
for e in g.edges():
config.add_edge_configuration("threshold", e, threshold)
model.set_initial_status(config)
# Simulation execution
iterations = model.iteration_bunch(200)
NDlib version
Operating System
Python version
Version(s) of NDlib required libraries
Expected behavior
I guess this issue is probably the community information is not inputted into the model.params['node']
The tutorial code does not run any community detection analysis. And the model.params['node'] gives an empty dict.
Additional context
Name: ndlib
Version: 5.0.2
Summary: Network Diffusion Library
Home-page: https://github.com/GiulioRossetti/ndlib
Author: Giulio Rossetti
Author-email: [email protected]
License: BSD-Clause-2
Location: /home/jasongong/anaconda3/lib/python3.7/site-packages
Requires: bokeh, dynetx, future, netdispatch, networkx, numpy, python-igraph, scipy
Required-by:
Note: you may need to restart the kernel to use updated packages.
The text was updated successfully, but these errors were encountered:
Hopefully you found the answer by now. For anyone else that arrives here for the same reason, there is a simple solution.
ifself.params['nodes']['com'][u] ==self.params['nodes']['com'][v]: # within same community# Individual specified thresholdsif'threshold'inself.params['edges']:
...
Describe the bug
I run the tutorial code of ICEmodel. And it produces the error code:
To Reproduce
The tutorial code I run:
Expected behavior
I guess this issue is probably the community information is not inputted into the model.params['node']
The tutorial code does not run any community detection analysis. And the model.params['node'] gives an empty dict.
Additional context
The text was updated successfully, but these errors were encountered: