我有一個igraph圖,並且想簡單地得到每個邊的from_id
和to_id
。例如:igraph從 - 獲得價值
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
我想要的是讓兩個變量v1
,v2
其中v1 = 3
和v2 = 1
(相當於v1 = 1
和v2 = 3
)。我想對圖E(g)[x], where x is the loop variable
中的所有邊進行此操作。有沒有辦法做到這一點?
由於