top of page

How to visualize dynamic network

Recently, I had to visualize dynamic network. More specifically, I had to visualize social contagion (crowdfunding participation) over a social network. I would like to share may experience how to visualize the dynamic network.

I employ animations to incorporate dynamic characteristic into my plot. Basically, I have two options: GIF or HTML. HTML can provide interactive plot, whereas GIF is more easy to be embedded to any environment. Thus, I produce a GIF which dynamically shows the social contagion over network.

Each node represents an individual under a crowdfunding platform. Each edge stands for co-investor relationship between two individuals. Specifically, if two individuals share at least one project in their investment portfolio, then they are connected constituting a co-investor network. The white colored nodes are non-investors, whereas the red colored nodes are investors. Also, the darker the color, the more investment.

The idea of producing GIF is simple. Draw various plots and then combine them. Here are some details.

Pacakges

library(igraph) library(network) library(sna) library(ndtv) library(networkD3) library(animation)

Color Palette

palf = colorRampPalette(c("white", "dark red")) col_list = palf(10)

Network Information Load net2 = graph.data.frame(links, nodes, directed=F) net2 = simplify(net2, remove.multiple = T, remove.loops = T) l = layout.random(net2)

Plot Figures and Combine

saveGIF({

t=0 net <- graph.data.frame(links[0,], nodes, directed=F) col <- rep("white", vcount(net)) plot(net, vertex.color=col, layout=l,vertex.label=rownames(nodes),edge.color="grey40")

for(t in 1:ntobs){ net <- graph.data.frame(links[links$time==(t),], nodes, directed=F) net <- simplify(net, remove.multiple = T, remove.loops = T) col <- col_list[temp_cum_nodes[,t]+1] plot(net, vertex.color=col, layout=l,vertex.label=rownames(nodes),edge.color="grey40") } },interval = 0.5, movie.name="network_animation_50.gif" )

Enjoy!

bottom of page