Load data

library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
##     filter, lag
## The following objects are masked from 'package:base':
##
##     intersect, setdiff, setequal, union
load("../digs-reply-network.Rdata")
glimpse(net_reply)
## Observations: 514
## Variables: 4
## $ date   <chr> "2016-01-25", "2016-01-25", "2016-01-25", "2016-01-25",...
## $ week   <chr> "1", "1", "1", "1", "1", "2", "2", "2", "2", "1", "1", ...
## $ source <chr> "19235", "24712", "25034", "24979", "25382", "23971", "...
## $ target <chr> "25382", "19235", "24422", "24633", "25507", "24010", "...

Create networks for weeks

unique(net_reply$week)
##  [1] "1"  "2"  "5"  "3"  "6"  "4"  "7"  "8"  "9"  "10" "11" "12" "13" NA
library(network)
## network: Classes for Relational Data
## Version 1.13.0 created on 2015-08-31.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
##                     Mark S. Handcock, University of California -- Los Angeles
##                     David R. Hunter, Penn State University
##                     Martina Morris, University of Washington
##                     Skye Bender-deMoll, University of Washington
##  For citation information, type citation("network").
##  Type help("network-package") to get started.
net_1 <- network(as.matrix(net_reply %>% filter(week == "1") %>% select(source, target)), directed = TRUE)
net_2 <- network(as.matrix(net_reply %>% filter(week == "2") %>% select(source, target)), directed = TRUE)
net_3 <- network(as.matrix(net_reply %>% filter(week == "3") %>% select(source, target)), directed = TRUE)
net_4 <- network(as.matrix(net_reply %>% filter(week == "4") %>% select(source, target)), directed = TRUE)
net_5 <- network(as.matrix(net_reply %>% filter(week == "5") %>% select(source, target)), directed = TRUE)
net_6 <- network(as.matrix(net_reply %>% filter(week == "6") %>% select(source, target)), directed = TRUE)
net_7 <- network(as.matrix(net_reply %>% filter(week == "7") %>% select(source, target)), directed = TRUE)
net_8 <- network(as.matrix(net_reply %>% filter(week == "8") %>% select(source, target)), directed = TRUE)
net_9 <- network(as.matrix(net_reply %>% filter(week == "9") %>% select(source, target)), directed = TRUE)
net_10 <- network(as.matrix(net_reply %>% filter(week == "10") %>% select(source, target)), directed = TRUE)
net_11 <- network(as.matrix(net_reply %>% filter(week == "11") %>% select(source, target)), directed = TRUE)
net_12 <- network(as.matrix(net_reply %>% filter(week == "12") %>% select(source, target)), directed = TRUE)
net_13 <- network(as.matrix(net_reply %>% filter(week == "13") %>% select(source, target)), directed = TRUE)
# net_all <- network(as.matrix(net_reply %>% select(source, target)), directed = TRUE)

Create a temporal network

library(networkDynamic)
##
## networkDynamic: version 0.9.0, created on 2016-01-12
## Copyright (c) 2016, Carter T. Butts, University of California -- Irvine
##                     Ayn Leslie-Cook, University of Washington
##                     Pavel N. Krivitsky, University of Wollongong
##                     Skye Bender-deMoll, University of Washington
##                     with contributions from
##                     Zack Almquist, University of California -- Irvine
##                     David R. Hunter, Penn State University
##                     Li Wang
##                     Kirk Li, University of Washington
##                     Steven M. Goodreau, University of Washington
##                     Jeffrey Horner
##                     Martina Morris, University of Washington
## Based on "statnet" project software (statnet.org).
## For license and citation information see statnet.org/attribution
## or type citation("networkDynamic").
net_list = list(net_1, net_2, net_3, net_4, net_5, net_6, net_7, net_8, net_9, net_10, net_11, net_12, net_13)
tnet <- networkDynamic(network.list = net_list, vertex.pid="vertex.names")
## Neither start or onsets specified, assuming start=0
## Onsets and termini not specified, assuming each network in network.list should have a discrete spell of length 1
## Argument base.net not specified, using first element of network.list instead
## Initialized network of size 21 inferred from number of unique vertex.pids
## Created net.obs.period to describe network
##  Network observation period info:
##   Number of observation spells: 1
##   Maximal time range observed: 0 until 13
##   Temporal mode: discrete
##   Time unit: step
##   Suggested time increment: 1
head(as.data.frame(tnet))
##   onset terminus tail head onset.censored terminus.censored duration
## 1     0        1    1   19          FALSE             FALSE        1
## 2     0        1   11    1          FALSE             FALSE        1
## 3     0        4   15    9          FALSE             FALSE        4
## 4     5        6   15    9          FALSE             FALSE        1
## 5     0        1   13   10          FALSE             FALSE        1
## 6     6        7   13   10          FALSE             FALSE        1
##   edge.id
## 1       1
## 2       2
## 3       3
## 4       3
## 5       4
## 6       4

Visualize a temporal network

library(ndtv)
## Loading required package: animation
## Loading required package: sna
## Loading required package: statnet.common
## sna: Tools for Social Network Analysis
## Version 2.4 created on 2016-07-23.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
##  For citation information, type citation("sna").
##  Type help(package="sna") to get started.
##
## ndtv: version 0.10.0, created on 2016-5-6
## Copyright (c) 2016, Skye Bender-deMoll, University of Washington
##                     with contributions from
##                     Martina Morris, University of Washington
## Based on "statnet" project software (statnet.org).
## For license and citation information see statnet.org/attribution
## or type citation("ndtv").
# render.animation(tnet)
render.d3movie(tnet,output.mode = 'htmlWidget')
## No slice.par found, using
## slice parameters:
##   start:0
##   end:13
##   interval:1
##   aggregate.dur:1
##   rule:latest
## Calculating layout for network slice from time  0 to 1
## Calculating layout for network slice from time  1 to 2
## Calculating layout for network slice from time  2 to 3
## Calculating layout for network slice from time  3 to 4
## Calculating layout for network slice from time  4 to 5
## Calculating layout for network slice from time  5 to 6
## Calculating layout for network slice from time  6 to 7
## Calculating layout for network slice from time  7 to 8
## Calculating layout for network slice from time  8 to 9
## Calculating layout for network slice from time  9 to 10
## Calculating layout for network slice from time  10 to 11
## Calculating layout for network slice from time  11 to 12
## Calculating layout for network slice from time  12 to 13
## Calculating layout for network slice from time  13 to 14
## caching 10 properties for slice 0
## caching 10 properties for slice 1
## caching 10 properties for slice 2
## caching 10 properties for slice 3
## caching 10 properties for slice 4
## caching 10 properties for slice 5
## caching 10 properties for slice 6
## caching 10 properties for slice 7
## caching 10 properties for slice 8
## caching 10 properties for slice 9
## caching 10 properties for slice 10
## caching 10 properties for slice 11
## caching 10 properties for slice 12
## caching 10 properties for slice 13
## Loading required namespace: htmlwidgets
## loading ndtv-d3 animation widget...
# compute.animation(tnet, animation.mode='MDSJ', default.dist=38)
filmstrip(tnet, frames = 14, displaylabels=FALSE)
## No coordinate information found in network, running compute.animation

proximity.timeline(tnet,default.dist=6,
          mode='sammon',labels.at=17,vertex.cex=4)
## collapsing slice networks ...
## computing vertex positions using 1D sammon layout ...
##   computing positions for slice 1
##   computing positions for slice 2
##   computing positions for slice 3
##   computing positions for slice 4
##   computing positions for slice 5
##   computing positions for slice 6
##   computing positions for slice 7
##   computing positions for slice 8
##   computing positions for slice 9
##   computing positions for slice 10
##   computing positions for slice 11
##   computing positions for slice 12
##   computing positions for slice 13
## rendering splines for each vertex ...

Compute some basic temporal stats

Counts of the number of edges forming (edge onset at time point) and dissolving (edge terminus at time point):

library(tsna)
plot( tEdgeFormation(tnet) )

plot( tEdgeDissolution(tnet) )

Graph density:

plot( tSnaStats(tnet,'gden') )

Credit: ndtv workshop