The Hungarian algorithm is an optimization algorithm that finds the optimal assignment of tasks to resources, minimizing the total cost or maximizing the total profit.
You can install the Hungarian algorithm using npm:
$ npm install hungarian
const hungarian = require('hungarian');
const costMatrix = [
[1, 2, 3],
[3, 2, 1],
[2, 1, 3]
];
const result = hungarian(costMatrix);
console.log(result);
see LICENSE file