We plan to remove
as_adj() in favor of the more explicitly named
as_adjacency_matrix() so please use as_adjacency_matrix() instead.
Usage
as_adj(
graph,
type = c("both", "upper", "lower"),
attr = NULL,
edges = deprecated(),
names = TRUE,
sparse = igraph_opt("sparsematrices")
)Arguments
- graph
The graph to convert.
- type
Gives how to create the adjacency matrix for undirected graphs. It is ignored for directed graphs. Possible values:
upper: the upper right triangle of the matrix is used,lower: the lower left triangle of the matrix is used.both: the whole matrix is used, a symmetric matrix is returned.- attr
Either
NULLor a character string giving an edge attribute name. IfNULLa traditional adjacency matrix is returned. If notNULLthen the values of the given edge attribute are included in the adjacency matrix. If the graph has multiple edges, the edge attribute of an arbitrarily chosen edge (for the multiple edges) is included. This argument is ignored ifedgesisTRUE.Note that this works only for certain attribute types. If the
sparseargumen isTRUE, then the attribute must be either logical or numeric. If thesparseargument isFALSE, then character is also allowed. The reason for the difference is that theMatrixpackage does not support character sparse matrices yet.- edges
Logical scalar, whether to return the edge ids in the matrix. For non-existant edges zero is returned.
- names
Logical constant, whether to assign row and column names to the matrix. These are only assigned if the
namevertex attribute is present in the graph.- sparse
Logical scalar, whether to create a sparse matrix. The ‘
Matrix’ package must be installed for creating sparse matrices.
