# NOT RUN {
# 1) generate a random graph according to the ER model
g <- erdos.renyi.game(100, 1/100)
# 2) produce the induced subgraph only based on the nodes in query
subg <- dNetInduce(g, V(g), knn=0)
# 3) visualise the module with vertices being color-coded by scores
nnodes <- vcount(subg)
nsamples <- 10
data <- matrix(runif(nnodes*nsamples), nrow=nnodes, ncol=nsamples)
rownames(data) <- V(subg)$name
# output as a <a href="visNetAnimate.pdf">pdf</a> file
visNetAnimate(g=subg, data=data, filetype="pdf")
# output as a <a href="visNetAnimate.mp4">mp4</a> file but with dynamic layout
visNetAnimate(g=subg, data=data, filetype="mp4", glayout.dynamics=TRUE)
# output as a <a href="visNetAnimate.gif">gif</a> file but with dynamic layout
visNetAnimate(g=subg, data=data, filetype="gif", glayout.dynamics=TRUE)
# }
Run the code above in your browser using DataLab