Out of all the visuals I’ve produced, I think the "coolest" is the three-dimensional U.S. Supreme Court citation network 1080p movie I produced with Dan Katz (close friend, coauthor, and newly minted law professor!).  3D networks, especially dynamic ones, really invoke the "wow" factor.  Movies are especially important in dynamic cases too, since without the animation, you lose all context and understanding of what led the network to that point.  The 3D part may also seem unnecessary at first, but an extra dimension can go a long way to unwinding the hairball that most somewhat-dense networks form.  Balancing these benefits with the technical cost and rotation can be hard though, and every network is different.

  So how does it work?  I thought I’d use the recent #cn220 dataset I posted,  along with Python, igraph, and Cairo to demonstrate how 3D network animations can be generated.  In this example, we’ll be animating the rotation of a static snapshot of the #cn220 user graph.  Here’s an outline of the program:

  1. Build a network based @username mentions in the #cn220 tweet dataset.
  2. Calculate a three-dimensional Kamada-Kawai layout of (x,y,z) tuples.
  3. While sweeping the polar and azimuthal angles,
    1. Calculate a two-dimensional projection of the currently rotated layout.
    2. Draw the vertices and edges in increasing z-order.
    3. Output the surface.

  If we wanted to dynamically add and remove vertices or edges from this network, a number of changes need to be made to the algorithm to re-calculate and interpolate layouts across network snapshots.  I’ll save these details for another post, but if you’d like to generate dynamic network visualizations like this one, my graphmovie library for Python is designed to do just this.  

  I’ve posted the Python code based on the outline above as a gist at Github, and you can view it below the break.  The movie that it produces (with mencoder) is embedded below.  Make sure to go full-screen!