Skip to content
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

several fixes and improvements to multigraph #236

Merged
merged 8 commits into from
Jun 18, 2024

Conversation

RazinShaikh
Copy link
Contributor

@RazinShaikh RazinShaikh commented Jun 12, 2024

These fixes were found while adding multigraph support in ZXLive. It would be nice to merge this sooner as the ZXLive main branch is broken right now.

@RazinShaikh RazinShaikh changed the title changed_edge_types is necessary in diff for backwards compatibility with simple graph several fixes and improvements to multigraph Jun 17, 2024
@akissinger
Copy link
Member

akissinger commented Jun 18, 2024

This is failing mypy because list.remove doesn't return a value in diff.py line 63, so I think it doesn't like you using it in a if statement. This could be what you expect, but I'm having a hard time reading this one-liner. Maybe try being a bit less fancy?

Also more generally, in places where we used sets before (e.g. when we want to check containment many times), I suggest we use a proper multiset implementation, like this one: https://docs.python.org/3/library/collections.html#collections.Counter rather than lists, otherwise we might start to run in to some performance problems.

@RazinShaikh
Copy link
Contributor Author

That line is a bit hacky. I can change it to Counter.

@akissinger akissinger merged commit a11c8f8 into zxcalc:master Jun 18, 2024
3 checks passed
@RazinShaikh
Copy link
Contributor Author

I didn't test properly when I changed to Counter. I have fixed a bug where the correct way of looping through Counter is to call Counter.elements(). It is fixed in PR #241.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants