Code Monkey home page Code Monkey logo

blossom's Introduction

Blossom

An implementation of the blossom algorithm for constructing maximum matchings on graphs.

blossom's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

blossom's Issues

Possible improvements

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.