Graph database seem to have really matured in the last year or so, and even appeared in some very high-profile current events (i.e Panama Papers https://panamapapers.icij.org/). I'm curious to see how well Neo4J supports dynamic network data.
First, a confession: I never read Lord of the Flies. I remember thinking as a kid that it sounded scary and grim, and have yet to get around to reading it as an adult. But now I don’t have to because, thanks to Jimi Adams, I can watch a network animation of the the evolving social structure in the novel :-)
Jimi used the book in an undergrad SNA course as a way to illustrate network concepts and metrics, reporting the experience in a paper Using Lord of the Flies to Teach Social Networks. In the process he coded up all the conversations between characters in the novel (directed blue ties) — as well as their co-appearances in the same locations (undirected gray ties) — as a longitudinal network. The 473 time slices were then rendered as a video using the ndtv R package. The paper gives links to time points in the movie where the network structures can be used as examples of the concepts he discusses.
Jimi made the data available for download as a single R networkDynamic object at http://goo.gl/YWMSXQ. Encoded in the object are the durations accounting for node (dis-)appearances, durations for speaking and co-presence ties, as well as dynamic node attributes to indicate possession and transfer of the conch (the boys’ ceremonial ‘talking stick’, shown in green), and deaths. From correspondence, I’ve learned that the few red ties indicate violent conflict.
I was planning to post here an alternate temporal visualization using just one of the tie types, but realized that I’ll need to look at this in more detail in a future post. I had been thinking of this network as multiplex (with the potential for more than one edge active between a pair of vertices) but in fact tie types are coded as a dynamic ‘weight’ attribute with with discrete values for each type. This works fine for the movie but it means that tie types are mutually exclusive. Although pair of characters can’t be coded as simultaneously co-present and talking, as a work around we could probably infer the former from the latter since conversations are face to face. However the main issues is that, off the top of my head, I don’t have a method for extracting one dynamic network from another including edges as active only when an attribute is active with a certain value. Stay tuned ..
A conversation on the SOCNET mailing list made me think that it might be worth writing up a quick illustration of how to do this in R with the
network library. There are a 3 steps to a really basic geographic network plot:
- Get relational data with appropriate lat and long coordinates for vertices (the hard step!)
- Tell one of the R mapping libraries to plot a map
- Tell the network library to plot the network with the lat & long coordinates, without first erasing the map
Olaf Rank posted on the Socnet listserv yesterday about rendering 3d views of networks as movies. I created a quick rmarkdown document with both an rgl animation and a movie. To make it one step more meta, I’ve also embedded the document here on the blog post :-) If you scroll down, you can find the rgl view of the network and drag it to spin.
The movie that it renders out does not appear in the rmarkdown page, but I’ve added it here … if you happen to have the right video codecs installed. These days it seems like browser support for OpenGL may be better than rendering video! :-)
I’m experimenting with using a screencast as a way to give tutorials and publicize new features we release as part of the statnet packages. As my first attempt, here is a quick YouTube intro / demo to some of the key features in the ndtv (Network Dynamic Temporal Visualization) package
If you find this format useful, please let me know and maybe I’ll do videos for the full tutorial with more technical explanations. Its definitely a good challenge to talk about things to imaginary people :-)
I’m going to be giving an (obviously much longer) workshop on the ndtv, networkDynamic and tsna packages at the 2016 INSNA ‘Sunbelt’ social networks conference in Newport Beach (Los Angeles) California
Managing Dynamic Network Data in statnet:
Animations, Data Structures and Temporal SNA
Session Time: Tuesday April 5th, 3:00pm-6:00pm
The Foundation Center (recently?) released a neat web application that provides interactive visualization tools for their database of grant funding. It contains a “Constellation” interactive network view of grant-making relationships.
The network map is SVG, built with D3.js, and has a well designed interface with features for refining queries, and flipping between charts, tables, maps, and network views of the same data. Most of the graphic elements can be clicked on to bring up a popup with a more detailed breakdown. The network map is very reminiscent of Angels of the Right (2011), except that they seem to give access to all of the current IRS 990 data (not just conservative foundations) and provide lots of categorization and geocoding as well. Although it seems to be a paid subscription service (with a free trial?), much of the data for the US appears to be available to play with via democracy.foundationcenter.org Note that although the tool does provide CSV data downlaod for some views, this is not open data. The Terms of Service prohibit scraping, bulk download and web redistribution.
One criticism I have — common to many sites using the D3.js network template is — why should the user wait to watch the network layout process in real time? It can be performed so much more quickly in the background, without eating my entire CPU updating the browser DOM when I’m trying to type the next query. Also, I’m not sure exactly what some of the network stats are calculating (sometimes it reports number of connections per vertex < 1, which doesn't seem possible for these networks).
..and continuing in the thread of long-overdue R package updates, we’ve got a new ndtv version out as well.
Peek into the time prism
The package release adds some “whiteboard candy”: 2.5D orthogonal projection of networks in time along a z axis. For lack of a better name, I’ve dubbed it a
timePrism (let me know if you find a pre- existing better name). Think of viewing all of the slices from a filmstrip from an angle. Probably hard to follow for large networks (or lots of time slices) but nice for illustrating concepts in temporal networks when you want to convey time and structure and can accept some loss of detail. Especially with the ability to include splines connecting specific vertices for highlighting trajectories.
library(ndtv) data(toy_epi_sim) timePrism(toy_epi_sim, orientation=c('z','y','x'), # swap axes angle=40, spline.v=c(7, 29, 36, 70, 82, 96), # hilite the infected spline.col='red', spline.lwd=2, box=FALSE, planes=TRUE, # draw a semi-transparent 'plane' under each net vertex.col='ndtvcol' # use pre-created infection color scheme)
We finally got the alpha release of the new tsna package up on CRAN! The goal is for the package to be a repository of algorithms and techniques for doing Social Network Analysis on longitudinal networks stored as networkDynamic objects. It includes:
- Code for finding forward temporal paths through networks which will hopefully serve as the basis of lots of extensions of centrality measures.
- Tools for evaluating durations of ties, rates of change, etc
- Measures of sequence (Gibson’s p-shifts) from the relevent package
- Static projections of dynamic networks
- And of course it has wrappers for evaluating standard ‘static’ SNA metrics at multiple time points and returning a time series (using the ergm and sna packages).
The package vignette has lots more details.
As a quick example, the code below extracts a forward temporal path (think “what is the earliest journey a message could take from vertex 10 to each vertex in the network while respecting edge timing”) and plots it as a transmission tree, including the transmission time for each edge:
# load the libraries library(tsna) library(ndtv) # load a dynamic network example data("moodyContactSim") # compute the forward temporal path from vertex 10 at time 0 v10path< -tPath(moodyContactSim,10) # plotting trees still a little complicated, # but with Graphviz and ndtv we can do it plot(v10path, coord=network.layout.animate.Graphviz(as.network(v10path), layout.par = list(gv.engine='dot')), edge.label.col='blue', main='earliest fwd path transmission times from vertex 10')
Ran into this on a friend’s bookshelf a while back. Great advice. I think that
“Thou shalt not spread false information. Thou shalt not pervert information to enhance profit or status.”
“Do not exchange your best understanding of how things work for cheap social consensus.”
are particularly relevant guidelines for people working in information design. Should there be a Hippocratic Oath for data visualization? :-)
Continue reading Thou shalt not spread false information