EdgelistFromAdjacency {dils}R Documentation

Convert an adjacency matrix to filled edgelist.

Description

Given the adjacency matrix for a network return a data.frame listing all possible edges and the weights for each edge.

Usage

  EdgelistFromAdjacency(A,
    nodelist = paste("node", 1:nrow(A), sep = ""))

Arguments

A

matrix, see 'Details' for formatting assumptions.

nodelist

character, optional list of node names.

Details

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.

Value

data.frame, full list of all possible edges with weights for each in third column.

Author(s)

Stephen R. Haptonstahl srh@haptonstahl.org

References

https://github.com/shaptonstahl/

See Also

EdgelistFromIgraph

Examples

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)

[Package dils version 0.8.1 Index]