# layout_with_graphopt

0th

Percentile

##### The graphopt layout algorithm

A force-directed layout algorithm, that scales relatively well to large graphs.

Keywords
graphs
##### Usage
layout_with_graphopt(graph, start = NULL, niter = 500, charge = 0.001,
mass = 30, spring.length = 0, spring.constant = 1,
max.sa.movement = 5)with_graphopt(...)
##### Arguments
graph
The input graph.
start
If given, then it should be a matrix with two columns and one line for each vertex. This matrix will be used as starting positions for the algorithm. If not given, then a random starting matrix is used.
niter
Integer scalar, the number of iterations to perform. Should be a couple of hundred in general. If you have a large graph then you might want to only do a few iterations and then check the result. If it is not good enough you can feed it in again in the <
charge
The charge of the vertices, used to calculate electric repulsion. The default is 0.001.
mass
The mass of the vertices, used for the spring forces. The default is 30.
spring.length
The length of the springs, an integer number. The default value is zero.
spring.constant
The spring constant, the default value is one.
max.sa.movement
Real constant, it gives the maximum amount of movement allowed in a single step along a single axis. The default value is 5.
...
Passed to layout_with_graphopt.
##### Details

layout_with_graphopt is a port of the graphopt layout algorithm by Michael Schmuhl. graphopt version 0.4.1 was rewritten in C and the support for layers was removed (might be added later) and a code was a bit reorganized to avoid some unneccessary steps is the node charge (see below) is zero.

graphopt uses physical analogies for defining attracting and repelling forces among the vertices and then the physical system is simulated until it reaches an equilibrium. (There is no simulated annealing or anything like that, so a stable fixed point is not guaranteed.)

##### Value

• A numeric matrix with two columns, and a row for each vertex.

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.auto, layout_nicely, nicely; layout.davidson.harel, layout_with_dh, with_dh; layout.gem, layout_with_gem, with_gem; 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