Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hungarianalg-0.0.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hungarianalg-0.0.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file hungarianalg-0.0.1.tar.gz.

File metadata

  • Download URL: hungarianalg-0.0.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.8

File hashes

Hashes for hungarianalg-0.0.1.tar.gz
Algorithm Hash digest
SHA256 96bf3123d97f1ab7c546502ccf2345e48c96e03884f88ba058e8d24ece0ef2b6
MD5 cd9d7f581b370488fef1a19e0e348850
BLAKE2b-256 a43de7df012633d85a067ed1783035d55ea7d5bae642edc0be0f44a84648f8da

See more details on using hashes here.

File details

Details for the file hungarianalg-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: hungarianalg-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.8

File hashes

Hashes for hungarianalg-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 769e17ed51445522b1e6256eee9560edd1dbb78244714d4b5c0f25d88812c2c5
MD5 0c0507d15495a7bb69e05163bd06aeb8
BLAKE2b-256 1b774eefde689e0b0476b985cef618af428635634efdb1820da777258e747eb7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page