Skip to content

kjkjava/Hungarian.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hungarian.js

A JavaScript implementation of the Hungarian algorithm.

About This

The Hungarian algorithm is used to optimize the pairing of items between two sets, where each pairing has an associated cost. The problem is known as the "assignment problem," and is typically represented as a matrix of costs or a weighted bipartite graph. Wikipedia goes into more detail on both the Hungarian algorithm and the assignment problem.

Hungarian.js is a JavaScript implementation of the algorithm.

Usage: hungarian(matrix, [isProfitMatrix=false], [returnSum=false])

Credits

This code was ported from the Java implementation at https://github.com/w01fe/hungarian/blob/master/src/jvm/w01fe/hungarian/HungarianAlgorithm.java which was originally from http://konstantinosnedas.com/dev/soft/munkres.htm (by Konstantinos A. Nedas).

It wasn't hard because Java and JavaScript are the same thing (jokes). But really, it's very similar to the original. I suppose it's not common to see O(n^3) algorithms written in JavaScript, but the future is now!

About

A JavaScript implementation of the Hungarian algorithm.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published