layout: Layouts

Description Usage Arguments Details Value Functions Examples

Description

Layout your graph.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
sg_layout(
  sg,
  directed = TRUE,
  layout = igraph::layout_nicely,
  save_igraph = TRUE,
  ...
)

sg_get_layout(
  nodes,
  edges,
  directed = TRUE,
  layout = igraph::layout_nicely,
  save_igraph = TRUE,
  ...
)

Arguments

sg

An object of class sigmajs as instantiated by sigmajs.

directed

Whether or not to create a directed graph, passed to graph_from_data_frame.

layout

An igraph layout function.

save_igraph

Whether to save the igraph object used internally.

...

Any other parameter to pass to layout function.

nodes, edges

Nodes and edges as prepared for sigmajs.

Details

The package uses igraph internally for a lot of computations the save_igraph allows saving the object to speed up subsequent computations.

Value

sg_get_layout returns nodes with x and y coordinates.

Functions

Examples

1
2
3
4
5
6
7
8
9
nodes <- sg_make_nodes(250) # 250 nodes
edges <- sg_make_edges(nodes, n = 500)

sigmajs() %>%
  sg_nodes(nodes, id, size, color) %>%
  sg_edges(edges, id, source, target) %>%
  sg_layout()

nodes_coords <- sg_get_layout(nodes, edges)

JohnCoene/sigmajs documentation built on Feb. 1, 2021, 12:12 p.m.