# igraph & gexf

#### John Coene

#### 2019-04-09

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)