[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [igraph] Speed comparison of R and C
From: |
cheng-chun Tu |
Subject: |
RE: [igraph] Speed comparison of R and C |
Date: |
Fri, 11 Feb 2011 22:03:41 -0500 |
Hi Jeremy,
Thanks a lot for your advice and the sample code! So basically you suggest that
to have better performance, we should manipulate the attributes as a vector
rather than graph object. And, this needs a index to identify the edge
corresponding to the location at the vector.
After carefully examining my R code, I did the following:
1. Avoid copying when functions are called: For every function call, carefully
check the possible size of every parameter when graph becomes large. If there
is any, make the parameter global variable. (R seems not support call by
reference or macro?)
2. For every part of code accessing edge/node attributes, maintain an index and
access then as vectors.
However, I found in some cases I could not avoid copying. For example the
build-in functions. For example my algorithm has recursively called
"neighbors(graph, id)". The graph will be copied so many times and affects the
performance. I search the r-mailing list trying to find call by reference or
macro definition but it seems there is no easy solutions.
Regards,
William
Stony Brook University
- RE: [igraph] Speed comparison of R and C, (continued)
- RE: [igraph] Speed comparison of R and C, jeremy.raw, 2011/02/08
- Re: [igraph] Speed comparison of R and C, Tamas Nepusz, 2011/02/08
- Re: [igraph] Speed comparison of R and C, William Tu, 2011/02/08
- Re: [igraph] Speed comparison of R and C, William Tu, 2011/02/08
- Re: [igraph] Speed comparison of R and C, Tamás Nepusz, 2011/02/08
- Re: [igraph] Speed comparison of R and C, Gábor Csárdi, 2011/02/08
- RE: [igraph] Speed comparison of R and C, jeremy.raw, 2011/02/09
- [igraph] Bipartitle community detection, Liang Wang, 2011/02/09
- Re: [igraph] Bipartitle community detection, Tamás Nepusz, 2011/02/10
RE: [igraph] Speed comparison of R and C,
cheng-chun Tu <=