# NOT RUN {
nodes <- sg_make_nodes()
edges <- sg_make_edges(nodes)
sg <- sigmajs() %>%
sg_nodes(nodes, id, label, size, color) %>%
sg_edges(edges, id, source, target)
sg # no layout
# layout
sg %>%
sg_layout()
# directed graph
edges$type <- "arrow" # directed
# omit color
sigmajs() %>%
sg_nodes(nodes, id, label, size) %>%
sg_edges(edges, id, source, target, type) %>%
sg_settings(defaultNodeColor = "#141414")
# all source and target are present in node ids
all(c(edges$source, edges$target) %in% nodes$id)
# }
Run the code above in your browser using DataLab