igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] basic question on selecting a vertex


From: Charles Novaes de Santana
Subject: Re: [igraph] basic question on selecting a vertex
Date: Tue, 20 Mar 2012 19:20:34 +0100

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
<address@hidden> 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: address@hidden
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> 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



reply via email to

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