Hi Simone, Considering you have the names of your vertices in a variable named "vertices", in a very straightforward way you could do:
v1<-which(vertices=="this"); v2<-which(vertices=="that"); g<-add.edges(g,c(v1,v2)); So, the R function you are looking for is called "which". Surely there are other (more elegant) ways to do it, but that is the one I remember now. All the best, Charles On Tue, Mar 20, 2012 at 6:59 PM, Simone Gabbriellini <[email protected]> wrote: > Dear List, > > sorry for this very basic question, but I am trying to select a vertex > based on the value of an attribute. I forgot the R syntax, and I got > lost trying to pick it up again... > > I would like to create an edge between two nodes for which I only know > the value of the attribute, like: > > add.edges(g, c( the-ID-of-vertex-with-name=="this", > the-ID-of-vertex-with-name=="that")) > > can you please advice? > > Best, > Simone > > -- > Dr. Simone Gabbriellini > > DigitalBrains srl > Amministratore > > mobile: +39 3403975626 > mail: [email protected] > > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help -- Um axé! :) -- Charles Novaes de Santana http://www.imedea.uib-csic.es/~charles PhD student - Global Change Laboratorio Internacional de Cambio Global Department of Global Change Research Instituto Mediterráneo de Estudios Avanzados(CSIC/UIB) Calle Miquel Marques 21, 07190 Esporles - Islas Baleares - España Office phone - +34 971 610 896 Cell phone - +34 660 207 940 _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
