View source: R/graph_structures.R
as_adj_weighted | R Documentation |
returns the weighted adjacency matrix in dense format
as_adj_weighted(g, attr = NULL)
g |
An igraph object |
attr |
Either NULL or a character string giving an edge attribute name. If NULL a traditional adjacency matrix is returned. If not NULL then the values of the given edge attribute are included in the adjacency matrix. |
This method is faster than as_adj from igraph if you need the weighted adjacency matrix in dense format
Numeric matrix
David Schoch
library(igraph)
g <- sample_gnp(10, 0.2)
E(g)$weight <- runif(ecount(g))
as_adj_weighted(g, attr = "weight")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.