Skip to content

Installing ‘intergraph’ package

2010 September 17
by Michał

After some e-mails I decided to put together a bit more detailed instruction how to install the ‘intergraph’ package together with the namespaced version of the ‘network’ package. See here.

There seemed to be some problems with downloading the namespaced ‘network’ from my webstite (thanks Neil!). File permissions were set incorrectly. I fixed that and everything should be OK now.

Because it’s Friday, another example of using ‘intergraph’. This time plot a network using both ‘igraph’ and ‘network’ functionality on the same plotting device. Here is the result:

And here is the code to produce it. lx in line 13  is “Deus Ex Machina”, or rather “Deus Ex locator()”… 😉

# rescale 'x' to [-1; 1]
res <- function(x)
 a <- -1 - (2*min(x))/(max(x)-min(x))
 b <- 2 / (max(x) - min(x))
 a + b*x
op <- par(mar=rep(0.5,4))
net <- # using 'intergraph'
k <- apply(layout.fruchterman.reingold(exIgraph), 2, res)
lx <- c(-0.5, -1)
k2 <- sweep(k, 2, lx, "+")
plot(exIgraph, layout=k, rescale=FALSE, xlim=range(rbind(k, k2)[,1]),
     ylim=range(rbind(k, k2)[,2]) )
plot(net, coord=k2, displaylabels=TRUE, label=net %v% "label", new=FALSE)
6 Responses leave one →
  1. prasoon permalink
    September 18, 2010

    Hi there, I’ve tried many R packages for social network analysis in the past but found them deficient for what I needed. So I tried other network visualization tools and used them in conjunction with R and that was a rewarding experience. More on

    • September 18, 2010

      Hi, yes I tried Gephi once or twice. I didn’t use it too much though. Is it easy to explort/import network data between Gephi and R?

      • prasoon permalink
        September 18, 2010

        Yes, Gephi takes an edgelist and gefx file (xml) as input and its easy to create these in R. cheers

  2. Bob Stoner permalink
    September 18, 2010

    Still a noob at R but it’s such a post as yours that provides encouragement – thanks!

  3. Deepak Sharma permalink
    December 16, 2010

    Hi Michal,

    I was wondering if you can help me with something. I am new to R and SNA so forgive my ignorance.

    I am using the StatNet package.

    I am working with a very large directed network. It has about 10^7 edges and about 10^6 unique nodes. I created a ‘network’ data object collection using the network() command. The object is created and saved. But the object takes a lot of memory when loaded, around 2.6 GB of memory. Due to this when I run a ‘summary’ or ‘degree’ function on the graph my computer hangs.

    I am using a 64-bit 4GB machine running Windows Vista and R 2.10.1.

    I was wondering if there is a way I can break the network into chunks or work around the memory problem somehow. Please let me know.


    Deepak Sharma

    • December 16, 2010

      Hi Deepak,
      Couple of things:
      1. Very big data might be a problem. How big the problem is going to be depends on what do you want to do with the data? If you just want to calculate a degree distribution you should be on the safe side. If you want to do something more complicated then, unless you can use some better machine with lots of RAM, you are on your own.
      2. You might try R package ‘igraph’ instead of ‘network’. It is said to be more memory-efficient. People report successfully crunching million-node networks with it.
      3. Irrespective of the points above: the strategy of breaking the network into smaller chunks might actually be the best way to proceed. Usually it is much more informative to do some detailed analysis of multiple parts of a huge network instead of doing something very simple but for the whole graph. You did not write what sort of network you are analysing. Perhaps there are some meaningful ways for you to split it (several components? subgroups based on some node attributes?)

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS