% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversion.R
\name{as_biadjacency_matrix}
\alias{as_biadjacency_matrix}
\title{Bipartite adjacency matrix of a bipartite graph}
\usage{
as_biadjacency_matrix(
  graph,
  types = NULL,
  attr = NULL,
  names = TRUE,
  sparse = FALSE
)
}
\arguments{
\item{graph}{The input graph. The direction of the edges is ignored in
directed graphs.}

\item{types}{An optional vertex type vector to use instead of the
\code{type} vertex attribute. You must supply this argument if the graph has
no \code{type} vertex attribute.}

\item{attr}{Either \code{NULL} or a character string giving an edge
attribute name. If \code{NULL}, then a traditional bipartite adjacency matrix is
returned. If not \code{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.}

\item{names}{Logical scalar, if \code{TRUE} and the vertices in the graph
are named (i.e. the graph has a vertex attribute called \code{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.}

\item{sparse}{Logical scalar, if it is \code{TRUE} then a sparse matrix is
created, you will need the \code{Matrix} package for this.}
}
\value{
A sparse or dense matrix.
}
\description{
This function can return a sparse or dense bipartite adjacency matrix of a bipartite
network. The bipartite adjacency matrix is an \eqn{n} times \eqn{m} matrix, \eqn{n}
and \eqn{m} are the number of vertices of the two kinds.
}
\details{
Bipartite graphs have a \code{type} vertex attribute in igraph, this is
boolean and \code{FALSE} for the vertices of the first kind and \code{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.
}
\section{Related documentation in the C library}{
\href{https://igraph.org/c/html/0.10.17/igraph-Bipartite.html#igraph_get_biadjacency}{\code{get_biadjacency()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Structural.html#igraph_get_edgelist}{\code{get_edgelist()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_vcount}{\code{vcount()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_edges}{\code{edges()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_get_eids}{\code{get_eids()}}, \href{https://igraph.org/c/html/0.10.17/igraph-Basic.html#igraph_ecount}{\code{ecount()}}
}

\examples{

g <- make_bipartite_graph(c(0, 1, 0, 1, 0, 0), c(1, 2, 2, 3, 3, 4))
as_biadjacency_matrix(g)

}
\seealso{
\code{\link[=graph_from_biadjacency_matrix]{graph_from_biadjacency_matrix()}} for the opposite operation.

Other conversion: 
\code{\link{as.matrix.igraph}()},
\code{\link{as_adj_list}()},
\code{\link{as_adjacency_matrix}()},
\code{\link{as_data_frame}()},
\code{\link{as_directed}()},
\code{\link{as_edgelist}()},
\code{\link{as_graphnel}()},
\code{\link{as_long_data_frame}()},
\code{\link{graph_from_adj_list}()},
\code{\link{graph_from_graphnel}()}
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\concept{conversion}
\keyword{graphs}
