Skip to contents

This function can return a sparse or dense bipartite adjacency matrix of a bipartite network. The bipartite adjacency matrix is an \(n\) times \(m\) matrix, \(n\) and \(m\) are the number of vertices of the two kinds.


  types = NULL,
  attr = NULL,
  names = TRUE,
  sparse = FALSE



The input graph. The direction of the edges is ignored in directed graphs.


An optional vertex type vector to use instead of the type vertex attribute. You must supply this argument if the graph has no type vertex attribute.


Either NULL or a character string giving an edge attribute name. If NULL, then a traditional bipartite adjacency matrix is returned. If not NULL then the values of the given edge attribute are included in the bipartite adjacency matrix. If the graph has multiple edges, the edge attribute of an arbitrarily chosen edge (for the multiple edges) is included.


Logical scalar, if TRUE and the vertices in the graph are named (i.e. the graph has a vertex attribute called name), then vertex names will be added to the result as row and column names. Otherwise the ids of the vertices are used as row and column names.


Logical scalar, if it is TRUE then a sparse matrix is created, you will need the Matrix package for this.


A sparse or dense matrix.


Bipartite graphs have a type vertex attribute in igraph, this is boolean and FALSE for the vertices of the first kind and TRUE for vertices of the second kind.

Some authors refer to the bipartite adjacency matrix as the "bipartite incidence matrix". igraph 1.6.0 and later does not use this naming to avoid confusion with the edge-vertex incidence matrix.


Gabor Csardi


g <- make_bipartite_graph(c(0, 1, 0, 1, 0, 0), c(1, 2, 2, 3, 3, 4))
#>   2 4
#> 1 1 0
#> 3 1 1
#> 5 0 0
#> 6 0 0