[R] help finding edge connecting two nodes
Gábor Csárdi
csardi at rmki.kfki.hu
Sat Oct 20 02:11:53 CEST 2012
On Fri, Oct 19, 2012 at 2:50 PM, Dhaval Adjodah <nuclearr.d at gmail.com> wrote:
[...]
> Your way works best! Another way I found from stackoverflow (see the post
> at
> http://stackoverflow.com/questions/12964332/igraph-edge-between-two-vertices/12980550#12980550)
> was
> to convert the graph into an adjacency matrix and then use simple matrix
> indices .
Just make this clear. The example (repeated below) on the
stackoverflow page does _not_ convert the graph into an adjacency
matrix. The indexing only makes the graph look as if it was an
adjacency matrix. But there is no conversion at all.
Gabor
ps. I would appreciate if you didn't cross-post your questions
everywhere (R-help, igraph-help and stackoverflow, maybe other places
as well). Please only post it on the platform you prefer first and
then, if you don't get a good answer, try elsewhere. Thanks!
library(igraph)
g <- graph.ring(10)
g[1,2]
# [1] 1
E(g)$weight <- runif(ecount(g))
g[1,2]
# [1] 0.8115639
[...]
More information about the R-help
mailing list