Open pukanc opened 3 years ago
I am also having the same problem. I tried to recreate it as simply as possible:
from hungarian_algorithm import algorithm
G = {
0: {2: 4, 3: 6},
1: {2: 5, 3: 7}
}
print(algorithm.find_matching(G, matching_type = 'max', return_type = 'list'))
Output:
[((1, 3), 7), ((0, 3), 6)]
On the other hand, it seems to work when I use the exact same graph structure, but I instead make the nodes str
objects (though I cannot say for sure as I have not tested many examples):
H = {
'a': {'c': 4, 'd': 6},
'b': {'c': 5, 'd': 7}
}
print(algorithm.find_matching(H, matching_type = 'max', return_type = 'list'))
Output:
[(('a', 'c'), 4), (('b', 'd'), 7)]
Alright, thank you :)
I should mention that that I still think this is an open issue. You would expect the algorithm to work with integer nodes, and it would be a bit inconvenient to need to convert to str
. Plus, it is still not entirely clear if the same problems arise with str
, as it hasn't been tested.
Hello, I found an issue with the output. Code:
from hungarian_algorithm import algorithm
dict = {0: {8: 457, 10: 696, 16: 492}, 2: {8: 973, 10: 566, 16: 1156}, 18: {8: 271, 10: 1324, 16: 469}}
print(algorithm.find_matching(dict, matching_type = 'min', return_type = 'list'))
Output:[((0, 8), 457), ((2, 10), 566), ((18, 8), 271)]
The number 8 is in the output twice and that should make the output invalid.
Thank you for your help in advance :)