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

Possible improvements #1

Open
Molkree opened this issue Sep 20, 2022 · 0 comments
Open

Possible improvements #1

Molkree opened this issue Sep 20, 2022 · 0 comments

Comments

@Molkree
Copy link

Molkree commented Sep 20, 2022

Thanks for this repo! I have used it to solve one of the Google foobar challenges.

I would like to suggest some improvements to the code in this repo, I can send individual PRs for each point or one combined for multiple:

  1. Small auxiliary stuff like better .gitignore and other config files for commonly used tools: .gitignore, config files.
  2. Running commonly used code formatters: Black, isort, pyupgrade.
  3. Adding type hints.
  4. Removing custom copy and just using built-in Python module: see here.
  5. Simplifying Blossom id code, there's no need for class variable to track id, built-in id on instance is enough: one, two.
  6. Changed constructors for Forest, Matching for easier usage.
  7. Simplify augemnting Matching, there's no need to create a copy in our algorithm, we can modify the callee directly: see here.
  8. Simplify adding an edge to the Forest, there's only one possible path in the blossom algorithm that can happen: see here.
  9. Somewhat simplify finding bottom up path to the root: see here.
  10. Simplify finding Blossom in the Forest: see here. I should note that I wrote this code last year so I'm a bit rusty on it but I'm pretty sure it's still correct (all tests are passing and I passed foobar tests as well).
  11. Other small changes here and there leveraging Python idioms: see here.
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

No branches or pull requests

1 participant