Temporal networks with R and igraph (updated)

13 Responses

1. Shilin Jia says:

Thank you a lot for the update! I didn’t see the updated version at first and almost decided to downgrade igraph to 0.7.1. Your code is really elegant and helped my project a great deal. However, I believe that there is one line missing in your code. After deleting edges in the for loop, there should be a line of hiding inactive nodes. It’s only a miner point though.

2. Anonymous says:

This is so helpful! Thank you! I updated to igraph 1.0 and was lost about how to animate some networks I simulated without this tutorial. Bravo!

3. shari says:

Awesome 🙂 I came across previous version and was disappointed it did not work anymore, but found this post when I started to fix it myself..

4. Anonymous2 says:

A big thank you for this helpful post. Really incredibly useful, including that you posted the code and step-by-step explanations. Thanks again!

5. Johannes Björk says:

Great post, thanks! Would it be possible if the edge list contained several interactions per time point, i.e. where many nodes can appear/disappear per time point?

Following your example data, it would look something like this:

“id1”, “id2”, “time”
1 2 1
1 3 1
2 3 1
3 2 2
2 4 2
1 3 2
5 6 2
4 5 3
1 6 3
6 3 3
. . .
. . .
. . .

6. Rolf says:

Many thanks for the great post. I have a question: You say that it “considers past/present/future nodes/edges when calculating the the layout, but displays only present nodes/edges in the plot by making past and future nodes/edges transparent”. From what I understand, and can see, it does not make past edges transparent, even if they are not present at time t.

Thanks for your interest. If you just want to show present ties you will have to change the condition `which(E(g)\$time > time)` to `which(E(g)\$time > time & E(g)\$time < = time + delta)` in line 34

Yes, in principle it could handle that kind of dynamics.

9. Jan Medina says:

Thano you! It is a great post.

If you want diferent colors for the old and new nodes, what is best way to do this?

10. Chris says:

Great post, thank you!

Is it possible to have the edges increase in thickness with frequency of interaction rather than creating additional edges between paired nodes?

Sure, the only thing you have to do is to use the function `simplify` in each time step to get an aggregated version of the network, see http://igraph.org/r/doc/igraph-attribute-combination.html Then use that projected version of the network in the visualization at each time step.