-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Hi there, this is my first issue in Mesa so i'd be very happy to hear if theres anything i've missed, or any helpful advice you may have 😄
What's the problem this feature will solve?
Given that we're working with python, any amount of performance improvement is helpul. Networkx is significantly slower than rustworkx to build graphs and run algorithms. NX does have quite a broad range of graph methods, but Mesa doesn't make much use of these, so as far as i can tell we wouldn't be losing out.
Describe the solution you'd like
Convert graph-based classes to internally represent graphs with rustworkx. These include:
discreet_space.network.Network
space.NetworkGrid
I expect it should be possible to do this without changing the type signature of any functions. Additionally, for these classes, we can ensure backwards compatability by converting nx graphs using rx.networkx_converter
.
The main sticking point is that nodes are handled differently in rustworkx, in that they can't be arbitrary python objects. The workaround for this is to use the node index to access data stored in the PyGraph, when the actual object is required.
Additional context
From what I can see, changes to the visualisation module may be more involved than the changes to space classes. Networkx returns an Artist when drawing edges, wheras the rustworkx mpl_draw method returns a whole figure. I'd appreciate some input from someone more familiar with the visualization submodule.