graph_from_biadjacency_matrix {igraph} | R Documentation |
Create graphs from a bipartite adjacency matrix
Description
graph_from_biadjacency_matrix()
creates a bipartite igraph graph from an incidence
matrix.
Usage
graph_from_biadjacency_matrix(
incidence,
directed = FALSE,
mode = c("all", "out", "in", "total"),
multiple = FALSE,
weighted = NULL,
add.names = NULL
)
Arguments
incidence |
The input bipartite adjacency matrix. It can also be a sparse matrix
from the |
directed |
Logical scalar, whether to create a directed graph. |
mode |
A character constant, defines the direction of the edges in
directed graphs, ignored for undirected graphs. If ‘ |
multiple |
Logical scalar, specifies how to interpret the matrix elements. See details below. |
weighted |
This argument specifies whether to create a weighted graph
from the bipartite adjacency matrix. If it is |
add.names |
A character constant, |
Details
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.
graph_from_biadjacency_matrix()
can operate in two modes, depending on the
multiple
argument. If it is FALSE
then a single edge is
created for every non-zero element in the bipartite adjacency matrix. If
multiple
is TRUE
, then the matrix elements are rounded up to
the closest non-negative integer to get the number of edges to create
between a pair of vertices.
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.
Value
A bipartite igraph graph. In other words, an igraph graph that has a
vertex attribute type
.
Author(s)
Gabor Csardi csardi.gabor@gmail.com
See Also
make_bipartite_graph()
for another way to create bipartite
graphs
Other biadjacency:
as_data_frame()
Examples
inc <- matrix(sample(0:1, 15, repl = TRUE), 3, 5)
colnames(inc) <- letters[1:5]
rownames(inc) <- LETTERS[1:3]
graph_from_biadjacency_matrix(inc)