EdgelistFromAdjacency {dils} | R Documentation |
Given the adjacency matrix for a network return a data.frame listing all possible edges and the weights for each edge.
EdgelistFromAdjacency(A, nodelist = paste("node", 1:nrow(A), sep = ""))
A |
matrix, see 'Details' for formatting assumptions. |
nodelist |
character, optional list of node names. |
This assumes that the row of the adjacency matrix indicates the node the edge is coming 'from', the column represent the node the edge is going 'to', and the value in the adjacency matrix is the weight given to the edge.
data.frame, full list of all possible edges with weights for each in third column.
Stephen R. Haptonstahl srh@haptonstahl.org
https://github.com/shaptonstahl/
n <- 10 A <- matrix(rnorm(n*n), nrow=n) A EdgelistFromAdjacency(A) n <- 100 A <- matrix(rnorm(n*n), nrow=n) A EdgelistFromAdjacency(A) n <- 500 A <- matrix(rnorm(n*n), nrow=n) A ## Not run: EdgelistFromAdjacency(A)