Add nodes and edges to a sigmajs graph.

sg_nodes(sg, data, ...)

sg_edges(sg, data, ...)

sg_edges2(sg, data)

sg_nodes2(sg, data)

Arguments

sg

An object of class sigmajsas intatiated by sigmajs.

data

Data.frame (or list) of nodes or edges.

...

any column.

Details

Eaach node must include a unique id, ideally the user passes x and y, if they are not passed then they are randomly generated. Each edge also must include a unique id.

Functions

  • Functions ending in *2 take a list that resembles the original sigma.js JSON inputs

  • Other functions take the arguments described above.

Examples

nodes <- sg_make_nodes() edges <- sg_make_edges(nodes) edges$type <- "arrow" # directed sigmajs() %>% sg_nodes(nodes, id, label, size, color) %>% sg_edges(edges, id, source, target, type)