as_incidence_matrix(graph, types = NULL, attr = NULL, names = TRUE,
sparse = FALSE)
type
vertex attribute. You must supply this argument if the graph has
no type
vertex attribute.NULL
or a character string giving an edge
attribute name. If NULL
, then a traditional incidence matrix is
returned. If not NULL
then the values of the given edge attribute are
included in the incidence matrix.TRUE
and the vertices in the graph
are named (i.e. the graph has a vertex attribute called name
), then
vertex names will be added to the result as row and column names. Otherwise
the ids of the vertices are useTRUE
then a sparse matrix is
created, you will need the Matrix
package for this.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_incidence_matrix
for the opposite operation.g <- make_bipartite_graph( c(0,1,0,1,0,0), c(1,2,2,3,3,4) )
as_incidence_matrix(g)
Run the code above in your browser using DataLab