Implementation of the Hungarian Algorithm for optimal matching in bipartite weighted graphs.
Project description
A Python 3 implementation of the Hungarian Algorithm for optimal matching in bipartite weighted graphs.
Based on the graph theory implementation in [these notes](http://www.cse.ust.hk/~golin/COMP572/Notes/Matching.pdf) combined with the matrix interpretation in [these notes](https://montoya.econ.ubc.ca/Econ514/hungarian.pdf).
For a detailed overview, see [this Jupyter notebook](https://github.com/jbrightuniverse/Hungarian-Algorithm-No.-5/blob/main/HungarianAlgorithm.ipynb).
# Usage
Installation: pip3 install hungarianalg
Import: from hungarianalg.alg import hungarian
Function call: result = hungarian(matrix)
Properties: - Optimal Matching: result.match - Revenues: result.revenues - Row Weights: result.row_weights - Col Weights: result.col_weights - Total Revenue: result.revenue_sum
See example.py for a comprehensive example.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for hungarianalg-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 769e17ed51445522b1e6256eee9560edd1dbb78244714d4b5c0f25d88812c2c5 |
|
MD5 | 0c0507d15495a7bb69e05163bd06aeb8 |
|
BLAKE2b-256 | 1b774eefde689e0b0476b985cef618af428635634efdb1820da777258e747eb7 |