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"),
weights = NULL,
attr = deprecated(),
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.- weights
One of the following:
NULL(default): use theweightedge attribute if the graph has one, otherwise return a traditional (unweighted) adjacency matrix.NA: explicitly unweighted, ignoring anyweightedge attribute.A numeric or logical vector of length
ecount(): use these values directly as edge weights.A character scalar: the name of an edge attribute whose values are used as weights. The attribute must be numeric or logical.
If multiple edges share endpoints, the value of an arbitrarily chosen edge is included in the matrix.
- attr
Use
weightsinstead. If supplied, the value is forwarded toweightsas a character edge attribute name.- 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.
Related documentation in the C library
get_adjacency(), get_adjacency_sparse(), vcount(), edges(), get_eids(), ecount()
