\HeaderA{graph.bipartite}{Create a bipartite graph}{graph.bipartite}
\keyword{graphs}{graph.bipartite}
\begin{Description}\relax
A bipartite graph has two kinds of vertices and connections
are only allowed between different kinds.
\end{Description}
\begin{Usage}
\begin{verbatim}
graph.bipartite(types, edges, directed=FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{types}] A vector giving the vertex types. It will be coerced into
boolean. The length of the vector gives the number of vertices in the
graph.
\item[\code{edges}] A vector giving the edges of the graph, the same way as
for the regular \code{\LinkA{graph}{graph}} function. It is checked that the
edges indeed connect vertices of different kind, accoding to the
supplied \code{types} vector.
\item[\code{directed}] Whether to create a directed graph, boolean
constant. Note that by default undirected graphs are created, as
this is more common for bipartite graphs.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Bipartite graphs have a \sQuote{\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.

\code{graph.bipartite} basically does three things. First it checks
tha \code{edges} vector against the vertex \code{types}. Then it
creates a graph using the \code{edges} vector and finally it adds the
\code{types} vector as a vertex attribute called \code{type}.
\end{Details}
\begin{Value}
A bipartite igraph graph. In other words, an igraph graph that has a
vertex attribute \code{type}.
\end{Value}
\begin{Author}\relax
Gabor Csardi \email{csardi@rmki.kfki.hu}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{graph}{graph}} to create one-mode networks
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
g <- graph.bipartite( rep(0:1,length=10), c(0:9))
print(g, v=TRUE)
\end{ExampleCode}
\end{Examples}

