You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem here is that the rows of the input matrix are cloned using new_row = row[:], which works just fine as long as the input is formatted as a plain list of lists of numbers (To be fair, this input format is also indicated by the docstring). However, for numpy arrays, this creates another numpy array which references the same underlying storage.
Changing new_row = row[:] to new_row = row.copy() in munkres.py should be fine, and I don’t really see any situation in which this might break something, since it also works fine for plain lists.
You might also want to look into #6, where someone already modified this module to use numpy internally.
The current Munkres.compute(cost_matrix) alters cost_matrix, in contrast with what is written in the docstring.
Example:
The text was updated successfully, but these errors were encountered: