Skip to content

Implements the Hungarian Algorithm#2191

Open
Ayushman-00 wants to merge 3 commits into
trekhleb:masterfrom
Ayushman-00:master
Open

Implements the Hungarian Algorithm#2191
Ayushman-00 wants to merge 3 commits into
trekhleb:masterfrom
Ayushman-00:master

Conversation

@Ayushman-00

Copy link
Copy Markdown

Description

Implements the Hungarian Algorithm (Kuhn-Munkres Algorithm) as requested in #1264.

The Hungarian algorithm solves the assignment problem in O(n³) time — given an n×n
cost matrix, it finds the optimal one-to-one assignment of agents to tasks that
minimizes total cost.

Changes

  • src/algorithms/sets/hungarian-algorithm/hungarianAlgorithm.js — Full implementation
  • src/algorithms/sets/hungarian-algorithm/__test__/hungarianAlgorithm.test.js — 10 test cases
  • src/algorithms/sets/hungarian-algorithm/README.md — Documentation with examples

Complexity

Type Value
Time O(n³)
Space O(n²)

Closes #1264

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is there a hungarian algorithm? It's good to have an implementaion of it in this project, imho

1 participant