library(ade4) bipartite_matrix <- as_incidence_matrix(g) # Extract the matrix # Method #2 is "simple matching" women_match <- dist.binary(bipartite_matrix, method=2, upper=TRUE, diag = FALSE) event_match <- dist.binary(t(bipartite_matrix), method=2, upper=TRUE, diag = FALSE) women_match <- as.matrix(women_match) matching_women <- ifelse(women_match>0.8, 1, 0) matching_women match_women <- graph_from_adjacency_matrix(matching_women, mode = "undirected") plot(match_women)