Layout the graph using an igraph layout function. This function only works with the graph was initialised with an object of class igraph.

layout_igraph(g, ..., method = igraph::layout_nicely)

Arguments

g

An object of class g2r or g2Proxy as returned by g2() or g2_proxy().

...

Any options to pass to the method function.

method

An igraph layout function to compute the nodes and edges (source and target) position on the canvas.

Details

The function runs the method to obtain the x and y coordinates. These are added to the nodes data.frame (extracted from initial graph) and to the edges data.frame, as x and y nested columns, e.g.: c(source_x, target_x). These x and y coordinates can be used in asp() (see example).

Examples

ig <- igraph::make_ring(100)

# use x and y for positioning
g2(ig, asp(x, y)) %>%
  layout_igraph() %>%
  fig_edge() %>%
  fig_point(asp(shape = "circle")) %>%
  axis_hide()