Learn R Programming

igraph (version 1.0.1)

layout_nicely: Choose an appropriate graph layout algorithm automatically

Description

This function tries to choose an appropriate graph layout algorithm for the graph, automatically, based on a simple algorithm. See details below.

Usage

layout_nicely(graph, dim = 2, ...)

nicely(...)

Arguments

graph

The input graph

dim

Dimensions, should be 2 or 3.

For layout_nicely the extra arguments are passed to the real layout function. For nicely all argument are passed to layout_nicely.

Value

A numeric matrix with two or three columns.

Details

layout_nicely tries to choose an appropriate layout function for the supplied graph, and uses that to generate the layout. The current implementation works like this:

  1. If the graph has a graph attribute called ‘layout’, then this is used. If this attribute is an R function, then it is called, with the graph and any other extra arguments.

  2. Otherwise, if the graph has vertex attributes called ‘x’ and ‘y’, then these are used as coordinates. If the graph has an additional ‘z’ vertex attribute, that is also used.

  3. Otherwise, if the graph is connected and has less than 1000 vertices, the Fruchterman-Reingold layout is used, by calling layout_with_fr.

  4. Otherwise the DrL layout is used, layout_with_drl is called.

See Also

plot.igraph

Other graph layouts: add_layout_; as_bipartite, layout.bipartite, layout_as_bipartite; as_star, layout.star, layout_as_star; as_tree, layout_as_tree; component_wise; in_circle, layout_in_circle; layout.davidson.harel, layout_with_dh, with_dh; layout.gem, layout_with_gem, with_gem; layout.graphopt, layout_with_graphopt, with_graphopt; layout.grid, layout.grid.3d, layout.grid.3d, layout_on_grid, on_grid; layout.mds, layout_with_mds, with_mds; layout.merge, layout_components, merge_coords, piecewise.layout, piecewise.layout; layout.norm, norm_coords; layout.sugiyama, layout_with_sugiyama, with_sugiyama; layout_on_sphere, on_sphere; layout_randomly, randomly; layout_with_fr, with_fr; layout_with_kk, with_kk; layout_with_lgl, with_lgl; layout, layout_, print.igraph_layout_modifier, print.igraph_layout_spec; normalize