1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_bipartite_graph}
\alias{make_bipartite_graph}
\alias{bipartite_graph}
\title{Create a bipartite graph}
\usage{
make_bipartite_graph(types, edges, directed = FALSE)
bipartite_graph(...)
}
\arguments{
\item{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.
When the vector is a named vector, the names will be attached to the graph
as the \code{name} vertex attribute.}
\item{edges}{A vector giving the edges of the graph, the same way as for the
regular \code{\link[=make_graph]{make_graph()}} function. It is checked that the edges indeed
connect vertices of different kind, according to the supplied \code{types}
vector. The vector may be a string vector if \code{types} is a named vector.}
\item{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.}
\item{...}{Passed to \code{make_bipartite_graph()}.}
}
\value{
\code{make_bipartite_graph()} returns a bipartite igraph graph. In other
words, an igraph graph that has a vertex attribute named \code{type}.
\code{is_bipartite()} returns a logical scalar.
}
\description{
A bipartite graph has two kinds of vertices and connections are only allowed
between different 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.
\code{make_bipartite_graph()} basically does three things. First it checks the
\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}. \code{edges} may contain strings as
vertex names; in this case, \code{types} must be a named vector that specifies
the type for each vertex name that occurs in \code{edges}.
}
\examples{
g <- make_bipartite_graph(rep(0:1, length.out = 10), c(1:10))
print(g, v = TRUE)
}
\seealso{
\code{\link[=make_graph]{make_graph()}} to create one-mode networks
Bipartite graphs
\code{\link{bipartite_mapping}()},
\code{\link{bipartite_projection}()},
\code{\link{is_bipartite}()}
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\concept{bipartite}
\keyword{graphs}
|