Generate nodes and edges.

sg_make_nodes(n = 10, colors = c("#B1E2A3", "#98D3A5", "#328983",
  "#1C5C70", "#24C96B"))

sg_make_edges(nodes, n = nrow(nodes) * 1.5)

sg_make_nodes_edges(n, ...)

Arguments

n

Number of nodes.

colors

Color palette to use.

nodes

Nodes, as generated by sg_make_nodes.

...

Any other argument to pass to sample_pa.

Value

tibble of nodes or edges or a list of the latter.

Functions

  • sg_make_nodes generate data.frame nodes.

  • sg_make_edges generate data.frame edges.

  • sg_make_nodes_edges generate list of nodes and edges.

Examples

nodes <- sg_make_nodes() edges <- sg_make_edges(nodes) sigmajs() %>% sg_nodes(nodes, id, label, size, color) %>% sg_edges(edges, id, source, target) %>% sg_settings(defaultNodeColor = "#0011ff")
#> Warning: Graph does not show in the RStudio Viewer; opening in browser