igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] accessing edges from the nodes


From: Gábor Csárdi
Subject: Re: [igraph] accessing edges from the nodes
Date: Fri, 22 Oct 2010 00:45:50 +0200

You should not be ashamed, we should be ashamed that this is not an
easy and straightforward thing to do. Anyway, here is how to do it:

g <- graph.ring(10)
E(g)[ 1 %--% 2 ]

What you get is an edge sequence, it is printed differently, but in
reality it is a numeric vector, just call as.vector() on it to get a
proper numeric vector.

Gabor

On Fri, Oct 22, 2010 at 12:37 AM, Renato Fabbri <address@hidden> wrote:
> i am a little ashamed to ask this, but i have wasted some real time on
> this and i
> cant find it out:
>
> if I want to access an edge beetween vertex 1 and 2, how do I do that?
>
> I am doing this:
>
> l=g.get_edgelist()
> i=l.index((k,j))
> g.es[i]["weight"]
>
> ii=l.index(kk,jj)
> g.es[ii]["weight"]
>
> etc
>
> is there a better way to do it?
>
> --
> GNU/Linux User #479299
> skype: fabbri.renato
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     UNIL DGM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]