Hi, can you send a reproducible example? See http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
Gabor On Mon, Feb 15, 2016 at 6:28 PM, Tony Larson <[email protected]> wrote: > > Hi, > I'm accessing a vertex attribute in R using V(g)$x, where x is a named > numeric attribute. If I do this for the whole graph (about 10e5 vertices), > it takes a few ms to get a vector of x values, > > vx <- V(g)$x > > If I then use vx as a target vector in an R loop to search through about > 10e3 candidate y values for x, it takes maybe 100 ms, > > for(i in 1:length(y)) > { > z <- which(vx > y[i]) > } > However, if I substitute V(g)$x for vx INSIDE the loop, it takes about 5s > - more than 50x slower. Why is this? > > Thanks > Tony > > Dr. Tony R. Larson > CNAP > Department of Biology, Area 7 > University of York > Wentworth Way > Heslington > York YO10 5DD > UK > > Tel: +44(0)1904 328 826 (office) > Tel: +44(0)7833 471 685 (mobile) > > [email protected] > > http://scholar.google.com/citations?user=9hLFka4AAAAJ > > > > > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help > _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
