How to use a different input to draw community polygons in igraph?

Could you please help me?

I love plotting networks with igraph. One nice feature is drawing polygons around the communities detected by a given algorithm.

When you use one of the community detection algorithms built in igraph, that’s pretty straightforward. Like in this example with a random bipartite graph:

library(igraph)
graph <- sample_bipartite(10, 10, p = 0.5)
graph
graph.lou = cluster_louvain(graph)
graph.lou$membership
length(graph.lou$membership)
plot(graph.lou, graph)

But how can I use another kind of input to draw those polygons?

For instance, I usually calculate modularity using the package bipartite, because it has other algorithms that are better suited for two-mode networks.

So I’m trying to use the output from bipartite as an input for drawing community polygons in igraph. As in the following example:

library(bipartite)
matrix <- as_incidence_matrix(graph)
matrix
matrix.bec = computeModules(matrix, method = "Beckett")
modules <- module2constraints(matrix.bec)
modules
length(modules)
plot(modules, graph)

From the output of the computeModules function I’m able to extract a vector with community memberships using the module2constraints function. When I try to use it as a plotting input, I get this error message:

Error in xy.coords(x, y, xlabel, ylabel, log) : 
  'x' and 'y' lengths differ

Is it possible to use this output from bipartite in igraph, so polygons are automatically drawn around the communities?

I’ve looked into the documentation, searched here in the forum and on StackOverflow, experimented some tricks, but found no solution.

Thank you very much!