Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotting large graph in R with igraph

I was trying to plot a network with 200 thousands nodes and 8 millions edges. The code I used was here:

library(igraph)
file.choose()
xlist<-read.graph("/Users/quyao/Desktop/redstar_relation.txt", format="ncol", directed=TRUE)
xlist
png('my_png.png', width = 1600, height =900)
plot(xlist)
dev.off()

I got this:

It's hard to study the topology with this kind of picture. Do you have any suggestions?

As there are too many nodes and edges, change the layout through the parameter 'layout' may not be so helpful.

Constructing this picture took about one and half hours using my code, how could i make it faster?

Many thanks.

like image 333
cxstam Avatar asked Jun 01 '26 17:06

cxstam


1 Answers

Consider using another software for visualization. I generally use Gephi for graphs with a magnitude up to 150 000 nodes.

However it really depends on how much RAM your machine has (mine has 8 GB). There is also the possibility to expand RAM allocation to Gephi by modifying their configuration file (it is not allocated automatically like in RStudio.

like image 115
anardin Avatar answered Jun 03 '26 07:06

anardin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!