I have an igraph graph and want to simply get each edge's from_id
and to_id
. For example:
g <- erdos.renyi.game(4, 1, type="gnm", directed=FALSE)
E(g)[1] # will return some edge, possibly not the same one
# Edge sequence:
# e
# e [1] 3 -- 1
What I want is to get two variables v1
, v2
where v1 = 3
and v2 = 1
(equivalent to v1 = 1
and v2 = 3
). I want to do this for all edges in the graph E(g)[x], where x is the loop variable
. Is there any way to do this?
Thanks