I have an incidence matrix:
Q = matrix(c(0,1,1,1,0,1,1,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0), nrow = 5, ncol=5)
rownames(Q) = c(64,32,47,42,58)
colnames(Q) = c(49,64,88,31,13)
I would like to list all possible max bipartite matchings. Using igraph:
G <- graph_from_incidence_matrix(Q)
M <- max_bipartite_match(G)
M$matching
which gives only one possible maximal matching:
64 32 47 42 58 49 64 88 31 13
"64" "49" "88" NA NA "32" "64" "47" NA NA
For instance, another one would be:
64 32 47 42 58 49 64 88 31 13
"64" "49" NA NA 88 "32" "64" "58" NA NA
Is there a way of getting the complete list of all possible bipartite matchings in R?
I have also tried with lpSolve:
res <- lp.assign(Q, "max")
but it also only gives me one possible solution instead of all.
Thanks for your help!