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: Gábor Csárdi
Subject: Re: [igraph] basic question on selecting a vertex
Date: Tue, 20 Mar 2012 14:16:50 -0400

On Tue, Mar 20, 2012 at 1: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?

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: address@hidden
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help



-- 
Gabor Csardi <address@hidden>     MTA KFKI RMKI



reply via email to

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