Learn R Programming

netUtils (version 0.8.3)

as_adj_weighted: weighted dense adjacency matrix

Description

returns the weighted adjacency matrix in dense format

Usage

as_adj_weighted(g, attr = NULL)

Value

Numeric matrix

Arguments

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.

Author

David Schoch

Details

This method is faster than as_adj from igraph if you need the weighted adjacency matrix in dense format

Examples

Run this code
library(igraph)
g <- sample_gnp(10, 0.2)
E(g)$weight <- runif(ecount(g))
as_adj_weighted(g, attr = "weight")

Run the code above in your browser using DataLab