On Tue, Mar 20, 2012 at 1: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?
Hi Simone,
in igraph 0.5.x you need something like
add.edges(g, match(c("this", "that"), V(g)$name)-1)
In igraph 0.6 it is simply
g + edge("this", "that")
assuming you are using the 'name' vertex attribute for vertex ids.
Gabor
> 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
--
Gabor Csardi <[email protected]> MTA KFKI RMKI
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help