munkres
Munkres (Hungarian) algorithm for the Assignment Problem
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 munkresuv
uv add munkrespoetry
poetry add munkresInstalling 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
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
lapSolves the linear assignment problem using the…
permissive · top 5,000 on PyPI
lapxSolves linear assignment problems using…
permissive · top 15,000 on PyPI
k-means-constrainedK-means clustering with enforced minimum and…
permissive · top 15,000 on PyPI
DijkstarDijkstar implements Dijkstra's shortest-path…
permissive · top 15,000 on PyPI
rectpackRectpack solves the 2D bin packing problem by…
permissive · top 15,000 on PyPI
klujaxSolves sparse linear systems in JAX using the…
copyleft · top 15,000 on PyPI
quadprogSolves strictly convex quadratic programming…
copyleft · top 15,000 on PyPI
qpsolversProvides a unified Python interface to solve…
copyleft · top 5,000 on PyPI
POTPOT provides solvers for optimal transport…
permissive · top 15,000 on PyPI
iterative-ensemble-smootherImplements ensemble-based data assimilation and…
copyleft · top 15,000 on PyPI