GithubHelp home page GithubHelp logo

johnridesabike / re-blossom Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 0.0 1.3 MB

A Reason implementation of the blossom maximum-matching algorithm

Home Page: https://johnridesa.bike/re-blossom/

License: MIT License

Reason 93.10% HTML 2.19% JavaScript 4.71%
reason reasonml bucklescript matching maximum-matching blossom-algorithm blossom

re-blossom's Introduction

Re-Blossom ๐ŸŒบ

GitHub package.json version Node.js CI GitHub

Re-Blossom is a Reason implementation of the famous blossom algorithm. It finds a maximum matching of vertices on general, undirected, weighted graphs.

๐Ÿ“– Read the documentation

Notice

If you're using ReScript, check out ReScript-Blossom. It's the same algorithm, but optimized for a JavaScript environment.

This package originally had similar optimizations, but I've reworked it to be more compatible with native-Reason. This package currently still relies on bs-platform to compile to JavaScript, but that's only for testing. All of the core modules should be native-compatible.

I'm not currently using this package in a native environment, so I haven't fully converted it yet. If you think you will find this useful, I encourage you to fork it and make the modifications you need.

Installation

Re-Blossom requires BuckleScript as a peer dependency, so you will have to install it separately. Add it by running:

npm install bs-platform -D

You can add Re-Blossom to your project by running:

npm install re-blossom

You will need to edit your project's bsconfig.json file and list Re-Blossom in the bs-dependencies.

{
  "bs-dependencies": [
    "re-blossom"
  ]
}

Development

Download the code:

git clone https://github.com/johnridesabike/re-blossom.git

If you want to make your own changes, then it's recommended to fork the repository on GitHub and clone your forked version.

Install the dependencies:

npm install

Compile a production build:

npm run build

Run the Reason watcher (not necessary if your IDE automatically compiles Reason):

npm run start

Run the tests:

npm run test

Run benchmarks that compare it to the similar JavaScript algorithm:

npm run bench

Run benchmarks in a browser:

npm run browser

Then open the URL provided and navigate to the __benchmarks__ directory.

To turn on debug logging, enable bs-log with the BS_LOG environmental variable:

BS_LOG=re-blossom=* npm run build

# or with your editor

BS_LOG=re-blossom=* vim

When reading the code, you may need familiarity with BuckleScript's uncurrying, as well as its map and set structures.

This code uses many terms and ideas from "Efficient algorithms for finding maximum matching in graphs" by Zvi Galil, ACM Computing Surveys, 1986. Reading the paper will make this code much more understandable.

re-blossom's People

Contributors

dependabot[bot] avatar johnridesabike avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.