Skip to contents

Turn the lower triangle of a connectivity matrix (e.g. correlation matrix or similar) to an edge list of the form: Source, Target, Weight

Usage

lotri2edgeList(A, filename = NULL, verbosity = 1L)

Arguments

A

Square matrix

filename

Character: Path for csv file. Defaults to "conmat2edgelist.csv"

verbosity

Integer: Verbosity level.

Value

Data frame with columns: NodeA, NodeB, Weight

Details

The output can be read, for example, into gephi

Author

EDG

Examples

A <- matrix(rnorm(100), nrow = 10)
A[lower.tri(A)] <- t(A)[lower.tri(A)]
diag(A) <- 1
edgelist <- lotri2edgeList(A, filename = NULL)
#> 2026-02-01 12:31:53 
#> Input dimensions are c(10, 10)
#>  [lotri2edgeList]
head(edgelist)
#>   NodeA NodeB      Weight
#> 1     1     2 -1.05761552
#> 2     1     3  0.60161662
#> 3     1     4  0.13152192
#> 4     1     5 -0.56455769
#> 5     1     6 -0.06133771
#> 6     1     7 -0.54243673