Coder Social home page Coder Social logo

munkres-js's Introduction

Munkres implementation for Javascript

Bower Version NPM Version NPM Downloads Build Status Coverage Status Dependency Status devDependency Status

Introduction

The Munkres module provides an O(n³) implementation of the Munkres algorithm (also called the Hungarian algorithm or the Kuhn-Munkres algorithm). The algorithm models an assignment problem as an N×M cost matrix, where each element represents the cost of assigning the ith worker to the jth job, and it figures out the least-cost solution, choosing a single item from each row and column in the matrix, such that no row and no column are used more than once.

Usage

var munkres = require('munkres-js');

munkres([
  [400, 150, 400],
  [400, 450, 600],
  [300, 225, 300]
])
// => [ [ 0, 1 ], [ 1, 0 ], [ 2, 2 ] ]

Returns the list of matrix indices corresponding to the optimal assignment.

When used in the browser, the global computeMunkres function is exposed.

See the docs in munkres.js for more details.

Meta

This module is a translation of a Python implementation by Brian Clapper.

The original implementation is based on http://csclab.murraystate.edu/~bob.pilgrim/445/munkres.html.

It is available via bower and npm as munkres-js.

Copyright

© 2014 Anna Henningsen (Conversion to JS)

© 2008 Brian M. Clapper

License

Apache License 2.0. See accompanying LICENSE file.

munkres-js's People

Contributors

addaleax avatar bmc avatar erelsgl avatar globegitter avatar ocozalp avatar

Watchers

 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.