igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] finding raw vertex index of a named vertex (R igraph)


From: George Vega Yon
Subject: Re: [igraph] finding raw vertex index of a named vertex (R igraph)
Date: Thu, 3 May 2018 11:23:15 -0700

As long as I understand the match function is vectorized, hence you don't need to do a one-by-one search, i.e. instead of sapply(list_of_names, match, vertex_attr(gt, "name")) you could simply do match(list_of_names, vertex_attr(gt, "name"))

HIH

George G. Vega Yon
+1 (626) 381 8171
https://ggvy.cl

On Thu, May 3, 2018 at 8:25 AM, Dr Gregory Jefferis <address@hidden> wrote:
Thank you, Gabor.

On 2 May 2018, at 17:46, Gábor Csárdi wrote:

> match('1001', vertex_attr(gt, "name"))

  match(1001, vertex_attr(gt, "name"))

is considerably faster than:

  match(1001, names(V(gt))

Best,

Greg.

--
Gregory Jefferis, PhD
Division of Neurobiology
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge Biomedical Campus
Cambridge, CB2 OQH, UK

http://www2.mrc-lmb.cam.ac.uk/group-leaders/h-to-m/g-jefferis
http://jefferislab.org
http://flybrain.stanford.edu

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help


reply via email to

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