All examples By author By category About

timelyportfolio

igraph + visNetwork in R

In response to visNetwork issue #5, here is a quick example how we might plot igraph graph with visNetwork.

library(igraph)
library(visNetwork)


graph.famous("Walther") %>%
  get.data.frame( what = "both" ) %>%
  {
    visNetwork(
      nodes = data.frame(
        id = unique( c( .[["edges"]][,"from"], .[["edges"]][,"to"] ) )
      )
      ,edges = .[["edges"]]
    )
  } %>%
  visOptions(highlightNearest = TRUE)