You don’t have to stick to nodes and edges data.frames, sigma.js accepts other formats.

igraph

You can create a graph from an igraph object.

data("lesmis_igraph") # load dataset

sigmajs() %>%
  sg_from_igraph(lesmis_igraph) %>%
  sg_settings(drawLabels = FALSE, drawEdgeLabels = FALSE)

You can also pass layout, if ommitted the function will use layout_nicely from the igraph package.

layout <- igraph::layout_on_grid(lesmis_igraph) # create layout

sigmajs() %>%
  sg_from_igraph(lesmis_igraph, layout) %>%
  sg_settings(drawLabels = FALSE, drawEdgeLabels = FALSE)

gexf

You can also create graphs from gexf files.

file <- "arctic.gexf"
url <- "https://raw.githubusercontent.com/Yomguithereal/gexf/master/test/resources/arctic.gexf"
download.file(url, file)

sigmajs() %>% 
  sg_from_gexf(file) %>%
  sg_settings()