views:

4

answers:

1

Hy Everybody!

Well, I'm working with the Igraph package, and i'd like to pick the edges by the name that I've assigned to their vertex, in a tiny example..

library(igraph)

g <- barabasi.game(8)

labels<-c("G1","G2","G3","T1","T2","T3","H1","H2")

V(g)$name<-labels

Now My edge list hast this form

> E(g)
Edge sequence:

    [0] G2 -> G1
    [1] G3 -> G2
    [2] T1 -> G2
    [3] T2 -> G3
    [4] T3 -> G1
    [5] H1 -> G1
    [6] H2 -> H1

What i want now is to find a way of, instead of using this

E(g)[1%--%2]

doing something more like E(g)[G2%--%G1] (calling the vertex by the name i've assigned), or an equivalent way of knowing some edges attributes by the name of the vertex involved

Thanks in advanced,

agos

A: 

This is not possible with the 0.5 branch of igraph, but the development version (0.6) adds support for referring to vertices based on their name attribute instead of their numeric IDs. I'm not sure how to do that as I am not familiar with the R interface. Try to subscribe to the igraph-help mailing list and ask there as this is definitely something that has been solved recently in igraph 0.6.

Tamás