[R] Performance of graph and igraph package
William Tu
u9012063 at gmail.com
Sat Feb 5 06:21:13 CET 2011
Dear R users,
I'm using graph library to create a mesh-like network topology and
implement a load balance routing algorithm. The current implementation
uses graph, RBGL, and Rgraphviz libraries. I have a few attributes on
every edge to represent the network loading and capacity, and I
frequently update these values. However, I found it works so slow and
right now I'm consider rewriting it using C or Python.
Then I found another library, which is "igraph". I made a performance
comparison between "graph" and "igraph" as below. For both graph, I
create two attributes for each edge and set/get the value of all edges
and measure the total elapsed time.
A. using graph package:
108 nodes, 832 edges: 17 sec
140 nodes, 4800 edges: 576 sec
B. using igraph package:
100 nodes, 4950 edges: 4 sec
200 nodes, 19900 edges: 111 sec
igraph is much much faster than graph! Is this reasonable? or I did
something wrong?
ps. I'm using 2 core 3GHz CPU with 2G ram.
Thanks in advance,
William
More information about the R-help
mailing list