A <- matrix(c(
0, 2, 1,
1, 0, 0,
1, 0, 1
), byrow = TRUE, ncol = 3)
matrix_to_edgelist(A, digraph = TRUE, valued = TRUE, loops = TRUE)
#> [,1] [,2] [,3]
#> [1,] "2" "1" "1"
#> [2,] "3" "1" "1"
#> [3,] "1" "2" "2"
#> [4,] "1" "3" "1"
#> [5,] "3" "3" "1"