Explicit network structure with Virus on a Network model #1427
-
The original Virus on a Network example runs fine. As I tend to do, I've stripped many features from it to simplify the model before I build new features on it for my purposes. However, I want to feed it an explicit network structure and not generate a randomly rewired Erdos Renyi graph. The code screenshot below includes many of the simplifications I made and you'll see the commented in/out attempts. The Mesa visualizer does produce the E-R graph and though it's unexciting due to limited features, if I start the model it'll run. However, the later attempts on lines 56 or 58/59 don't visualize and the model won't step, yet it provides no errors in the terminal. Thoughts? As always, many thanks to this wonderful community. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
That should work, but you don't need To debug I would run a print statement after you add the edges something like |
Beta Was this translation helpful? Give feedback.
-
You forgot to do this: net.add_nodes_from(range(self.num_nodes)) There is actually an error message from the console of the web browser, which says that the node doesn't exist. |
Beta Was this translation helpful? Give feedback.
-
Try |
Beta Was this translation helpful? Give feedback.
Try
edges = [(0,1),(1,2),(2, 0)]
instead ofedges = [(1,2),(2,3),(3, 1)]
.