R igraph manual pages

Use this if you are using igraph from R

layout_nicely {igraph}R Documentation

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.

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.

In layout algorithm implementations, an argument named ‘weights’ is typically used to specify the weights of the edges if the layout algorithm supports them. In this case, omitting ‘weights’ or setting it to NULL will make igraph use the 'weight' edge attribute from the graph if it is present. However, most layout algorithms do not support non-positive weights, so layout_nicely would fail if you simply called it on your graph without specifying explicit weights and the weights happened to include non-positive numbers. We strive to ensure that layout_nicely works out-of-the-box for most graphs, so the rule is that if you omit ‘weights’ or set it to NULL and layout_nicely would end up calling layout_with_fr or layout_with_drl, we do not forward the weights to these functions and issue a warning about this. You can use weights = NA to silence the warning.

Value

A numeric matrix with two or three columns.

Author(s)

Gabor Csardi csardi.gabor@gmail.com

See Also

plot.igraph

Other graph layouts: add_layout_(), component_wise(), layout_as_bipartite(), layout_as_star(), layout_as_tree(), layout_in_circle(), layout_on_grid(), layout_on_sphere(), layout_randomly(), layout_with_dh(), layout_with_fr(), layout_with_gem(), layout_with_graphopt(), layout_with_kk(), layout_with_lgl(), layout_with_mds(), layout_with_sugiyama(), layout_(), merge_coords(), norm_coords(), normalize()


[Package igraph version 1.3.5 Index]