Edgelist representation as array

I am wanting to get an edgelist from my graph that can then be used as a coordinate in 2D.

using LightGraphs
A = [
0 1 1
1 0 1
1 1 0

G = Graph(A)
EL = collect(edges(G))

How can the edge list EL be converted to an array EL2, where EL2 just contains the row and column index of an undirected edge?

EL2 = [
1 2
1 3
2 3

Thank you for any help on this :slight_smile:

I guess you can work on an adjacency matrix and find indices of non-zero elements, e.g.:

using LinearAlgebra
inds = findall(triu(A,1) .> 0)

(LinearAlgebra.triu is in the case of undirected graph.)
Then to get the Array, you can do for instance:

a = [ind.I for ind in inds]