File: make_bipartite_graph.Rd

package info (click to toggle)
r-cran-igraph 1.0.1-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,232 kB
  • sloc: ansic: 173,538; cpp: 19,365; fortran: 4,550; yacc: 1,164; tcl: 931; lex: 484; makefile: 149; sh: 9
file content (68 lines) | stat: -rw-r--r-- 2,180 bytes parent folder | download | duplicates (2)
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
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/attributes.R, R/make.R
\name{is_bipartite}
\alias{bipartite_graph}
\alias{graph.bipartite}
\alias{is.bipartite}
\alias{is_bipartite}
\alias{make_bipartite_graph}
\title{Create a bipartite graph}
\usage{
is_bipartite(graph)

make_bipartite_graph(types, edges, directed = FALSE)

bipartite_graph(...)
}
\arguments{
\item{graph}{The input graph.}

\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.}

\item{edges}{A vector giving the edges of the graph, the same way as for the
regular \code{\link{graph}} function. It is checked that the edges indeed
connect vertices of different kind, accoding to the supplied \code{types}
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 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}.

\code{is_bipartite} checks whether the graph is bipartite or not. It just
checks whether the graph has a vertex attribute called \code{type}.
}
\examples{
g <- make_bipartite_graph( rep(0:1,length=10), c(1:10))
print(g, v=TRUE)
}
\author{
Gabor Csardi \email{csardi.gabor@gmail.com}
}
\seealso{
\code{\link{graph}} to create one-mode networks
}
\keyword{graphs}