Created
May 4, 2020 05:36
-
-
Save ybenjo/c008caabf7b4bf5235b204859c6fcca9 to your computer and use it in GitHub Desktop.
scipy.sparse.csgraph.maximum_bipartite_matching is broken when get complete bipartite graph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.sparse import lil_matrix, csr_matrix | |
from scipy.sparse.csgraph import maximum_bipartite_matching | |
import random | |
N = 10 | |
M = 10 | |
random.seed(0) | |
for x in range(5): | |
mat = lil_matrix((N, M)) | |
for i in range(N): | |
for j in range(M): | |
w = random.randint(0, 100) | |
mat[i, j] = w | |
mat = csr_matrix(mat) | |
# solve | |
print(maximum_bipartite_matching(mat)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment