-
Notifications
You must be signed in to change notification settings - Fork 69
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
[Python] Remove networkx dependency #76
Comments
At the very least, it looks like we can move the dependency to catanatron gym, as all of the production usages are there (we define the graphs in catanatron.models.board, but only use them in the gym and in tests). That said, it looks like we do use the graph in the catanatron_gym - is that a usage we can easily replace with python stdlib objects or a performant custom class? |
There are some production usages of the These usages could be substituted to reading from a hard-coded lookup table (be it a dictionary or multidimensional array). Something like this seems to work:
That is, compute that once, save the result in a hardcoded python object of literals, and use that instead. |
Here the result:
|
It would break the ability for us to support customly-shaped maps, but thats ok for now. It seems we could always make the "72" bigger and just require all maps to be contained in a hexagon-like sea of water tiles, like they are right now. Then this would hold. |
where's the 72 coming from? |
Can this be closed? I don't see that nxgraph is still used after this 2021 PR |
Ahh.. I think the title of this Issue can be improved. It's actually called |
It seems using a pure-python dictionary-based data structure for graph operations makes catanatron simulate games faster than using the
nxgraph
library.nxgraph
is mostly used today just to consult neighbors for a given node, and so building a lookup table at game initialization (or even at simulation initialization) could make catanatron faster.The text was updated successfully, but these errors were encountered: