compute: unexpected side effect on cost_matrix
The current Munkres.compute(cost_matrix) alters cost_matrix, in contrast with what is written in the docstring. Example:
import numpy as np
from munkres import Munkres
cost_matrix = np.random.rand(10, 10)
cost_matrix_copy = cost_matrix.copy()
m = Munkres()
print(cost_matrix == cost_matrix_copy)
result = m.compute(cost_matrix)
print(cost_matrix == cost_matrix_copy)
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.