networkop/hungarian library

Hungarian Algorithm (Kuhn–Munkres) for assignment problems

Efficient O(n^3) implementation for finding a minimum-cost perfect matching between n workers and n jobs. The implementation is numeric and robust, suitable for production-quality usage on dense cost matrices.

API:

  • hungarian(costMatrix) -> returns pair (minCost, assignment list of length n)

Functions

hungarian(List<List<int>> cost) → List