-
Notifications
You must be signed in to change notification settings - Fork 948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to visualize dynamically evolving networks #1020
Comments
From the Boltzmann wealth model example, you can add/remove grid using standard Networkx operation (add_edge, remove_edge), operated on |
@rht, I get an error: "NetworkGrid object has no method "graph"". And furthermore, in the Boltzmann model. there is no example of the "add_edge" method being used on a grid (at least in the version that is currently uploaded in GitHub). |
Can you elaborate what this "transfer" is? |
Ah ok, I thought "G" was the generic name of the graph I wanted to put into the grid. For "transfer" I mean putting the graph entirely into the grid (with the nodes already inserted, without having to put them in one by one). |
You can't bypass doing Though if you meant specifically putting the graph entirely into the grid without involving agent, you can just pass in the entire graph |
But in the second case, doesn't it simply create a grid with empty nodes? |
Yes, is that a problem? As I said, |
Hi, so could you give an example on how to remove/add edges/nodes in a model step, please? |
@BogdanBalcau you can do this: def step(self):
self.G.add_node(node_idx)
self.G.remove_node(node_idx)
self.G.add_edge(from_idx, to_idx)
self.G.remove_edge(from_idx, to_idx) Where |
Will try that, thank you! |
Hey everybody!
First of all, I wanted to thank you all for the amazing work you're doing with Mesa. Keep the awesomeness!
I have an issue: I want to build a model whose network evolves at every step (i.e. new links are formed, some old links are dropped, etc.). The code per se is not difficult; the problem comes with the visualization.
In fact, I don't understand how to use the NetworkGrid object to handle such a situation. The two network models in the example folder, the Boltzmann wealth model and the virus on a network model, both have fixed edges, as far as I can understand. Does NetworkGrid have methods that allow me to pop off or insert new links? From the reference page, it doesn't seem so.
Thank you in advance for the help!
The text was updated successfully, but these errors were encountered: