skillfed

munkres

Munkres (Hungarian) algorithm for the Assignment Problem

munkres v1.1.4 476.8K downloads/30d#6,446 on PyPI
Permissive license Apache Software License Abandoned released

What it is and what it does

Munkres is a pure-Python implementation of the Munkres algorithm, a classical algorithm for solving the Assignment Problem—finding an optimal one-to-one matching between two sets of items given a cost matrix. The algorithm is also known as the Hungarian algorithm or Kuhn-Munkres algorithm.

The package provides a straightforward interface to compute the minimum-cost assignment. It has no external runtime dependencies, making it lightweight and easy to integrate. However, the project has been abandoned since its last release on 2020-09-15, meaning no new features or bug fixes will be added. For production use, you should verify that the implementation meets your numerical accuracy and performance requirements.

Use it for:

  • Solving assignment problems in operations research: assigning workers to tasks or resources to projects.
  • Object tracking in computer vision: matching detected objects across frames by minimizing distance.
  • Bipartite graph matching: finding optimal pairings between two sets of nodes in network analysis.
  • Logistics and transportation: assigning delivery routes or vehicles to minimize total cost.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Implements the Munkres algorithm (Hungarian algorithm) to solve the Assignment Problem, finding optimal one-to-one matchings between sets given a cost matrix.

Yes, if you need a lightweight, dependency-free implementation of the Munkres algorithm for a stable, non-evolving use case. The permissive license and low install friction make it accessible. However, the abandoned status (no updates since 2020-09-15) means you should verify the implementation meets your accuracy and performance needs before adopting it in new production systems.

Install

munkres on PyPI

pip

pip install munkres

uv

uv add munkres

poetry

poetry add munkres

Installing munkres

Before you install

Installation is frictionless—a pure Python wheel with no runtime dependencies. However, the package has been abandoned since 2020 (2159 days since last release), so it will not receive bug fixes or updates.

License in practice

Licensed under Apache Software License (permissive), so you can use it freely in commercial and open-source projects without restrictive obligations.

Quickstart

pip install munkres

from munkres import Munkres

m = Munkres()
cost_matrix = [[1, 2], [3, 4]]
indexes = m.compute(cost_matrix)

Verify before relying

  • Whether the implementation handles edge cases (empty matrices, rectangular cost matrices) correctly
  • Performance characteristics on large matrices and suitability for your specific use case
  • Compatibility with current Python versions beyond what the fact sheet specifies

Package facts

License Apache Software License (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 2,159 days since the last release
First released
Downloads 476,781/month — #6,446 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: munkres-1.1.4-py2.py3-none-any.whl

Intended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonTopic :: Scientific/Engineering :: MathematicsTopic :: Software Development :: Libraries :: Python Modules

Tags

munkres algorithmhungarian algorithmassignment problem solveroptimal matchingcost matrix assignmentkuhn-munkresbipartite matching
algorithmoptimizationmatching

More Python Modules packages