Incidence matrix from bipartite graph in python-igraph

What is the most efficient way of returning the incidence matrix of a bipartite graph in Python? I see that the R interface comes with a helper function called as_incidence_matrix, but I don’t see anything comparable in python-igraph.

(Essentially I am looking for the inverse of igraph.Graph.Incidence, which allows building a graph from an incidence matrix.)

It’s the get_incidence method.

1 Like

Note to people who might come across this thread:

igraph now uses the term “biadjacency matrix” instead of “incidence matrix” to refer to to the matrix that contains the edge counts between vertices of a bipartite graph.

Going forward, “incidence matrix” will be used to refer to the edge-vertex incidence matrix, which is the more standard use of this term in graph theory.

Old function names with “incidence” are now deprecated and will likely be re-used for the edge-vertex incidence matrix in a future release.