projectmesa / mesa

Mesa is an open-source Python library for agent-based modeling, ideal for simulating complex systems and exploring emergent behaviors.
https://mesa.readthedocs.io
Apache License 2.0
2.44k stars 874 forks source link

Add an example that uses directed graphs in Mesa #667

Open jackiekazil opened 5 years ago

jackiekazil commented 5 years ago

RE: #653

Seems like we need to add an example of directed graphs to Mesa. This might be adjusting how the network module works as well.

You could do this one of two ways.

  1. You could create a directed version of the existing virus on a network example, which would mean that the virus could only move in certain directions.

  2. You could recreate this model: http://ccl.northwestern.edu/netlogo/models/DiffusiononaDirectedNetwork

It seems like #1 would be an easier lift, but I will let you decided what you prefer.

kennethells commented 5 years ago

I'll work on this.

rht commented 5 years ago

Diffusion on a directed network's code: https://github.com/NetLogo/models/blob/master/Sample%20Models/Networks/Diffusion%20on%20a%20Directed%20Network.nlogo (it's kind of hard to parse because everything is in 1 file without boundaries)

I think it would cover more systems by porting 2) instead.

rozenlicht commented 4 years ago

I've chipped in by creating a PR that adds arrowheads to the D3.js visualization when "directed": True is added to edge in the portrayal dict inserted in NetworkModule. If this is the desired behavior, I could also code it for sigma. As the initial issue suggested implementing a "directed virus network" example, I've included this as well.

rht commented 1 year ago

This should be very easy to do with the new pure Python/Solara frontend, since it is essentially doing a NetworkX draw.

rht commented 1 year ago

@ankitk50 this is another low hanging fruit for warming up. The hardest part would be to find a model that behaves differently with a directed network instead of undirected network. This doesn't have to be from that NetLogo model I linked above.

ankitk50 commented 1 year ago

this sounds interesting, but also complex, I can add this to my list.

rht commented 1 year ago

I think one of the version proposed by @jackiekazil should do:

You could create a directed version of the existing virus on a network example, which would mean that the virus could only move in certain directions.

So it is not going to be a drastic modification over virus on a network.