graph_from_incidence_matrix
creates a bipartite igraph graph from an incidence
matrix.graph_from_incidence_matrix(incidence, directed = FALSE, mode = c("all",
"out", "in", "total"), multiple = FALSE, weighted = NULL,
add.names = NULL)from_incidence_matrix(...)
Matrix
package.out
NULL
then an unweighted graph is
created and the multiple
argument is used to determine the edges of
the graph. If it is a character cNA
or NULL
.
graph_from_incidence_matrix
can add the row and column names of the incidence
matrix as vertex attributes. If this argument is NULL
(the default)
and the incidence matrigraph_from_incidence_matrix
.type
.type
FALSE
for the vertices of the first kind and
TRUE
for vertices of the second kind.graph_from_incidence_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 incidence 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.
make_bipartite_graph
for another way to create bipartite
graphsinc <- matrix(sample(0:1, 15, repl=TRUE), 3, 5)
colnames(inc) <- letters[1:5]
rownames(inc) <- LETTERS[1:3]
graph_from_incidence_matrix(inc)
Run the code above in your browser using DataCamp Workspace