The Fruchterman-Reingold layout algorithmSource:
Place vertices on the plane using the force-directed layout algorithm by Fruchterman and Reingold.
The graph to lay out. Edge directions are ignored.
Optional starting positions for the vertices. If this argument is not
NULLthen it should be an appropriate matrix of starting coordinates.
Integer scalar, 2 or 3, the dimension of the layout. Two dimensional layouts are places on a plane, three dimensional ones in the 3d space.
Integer scalar, the number of iterations to perform.
Real scalar, the start temperature. This is the maximum amount of movement alloved along one axis, within one step, for a vertex. Currently it is decreased linearly to zero during the iteration.
Character scalar, whether to use the faster, but less accurate grid based implementation of the algorithm. By default (“auto”), the grid-based implementation is used if the graph has more than one thousand vertices.
A vector giving edge weights. The
weightedge attribute is used by default, if present. If weights are given, then the attraction along the edges will be multiplied by the given edge weights. This places vertices connected with a highly weighted edge closer to each other. Weights must be positive.
NULL, then it must be a numeric vector that gives lower boundaries for the ‘x’ coordinates of the vertices. The length of the vector must match the number of vertices in the graph.
minx, but gives the upper boundaries.
minx, but gives the lower boundaries of the ‘y’ coordinates.
minx, but gives the upper boundaries of the ‘y’ coordinates.
minx, but gives the lower boundaries of the ‘z’ coordinates.
minx, but gives the upper boundaries of the ‘z’ coordinates.
- coolexp, maxdelta, area, repulserad
These arguments are not supported from igraph version 0.8.0 and are ignored (with a warning).
A deprecated synonym of
niter, for compatibility.
A two- or three-column matrix, each row giving the coordinates of a vertex, according to the ids of the vertex ids.
See the referenced paper below for the details of the algorithm.
This function was rewritten from scratch in igraph version 0.8.0.
Fruchterman, T.M.J. and Reingold, E.M. (1991). Graph Drawing by Force-directed Placement. Software - Practice and Experience, 21(11):1129-1164.
Other graph layouts:
Gabor Csardi email@example.com
# Fixing ego g <- sample_pa(20, m = 2) minC <- rep(-Inf, vcount(g)) maxC <- rep(Inf, vcount(g)) minC <- maxC <- 0 co <- layout_with_fr(g, minx = minC, maxx = maxC, miny = minC, maxy = maxC ) co[1, ] #>  0 0 plot(g, layout = co, vertex.size = 30, edge.arrow.size = 0.2, vertex.label = c("ego", rep("", vcount(g) - 1)), rescale = FALSE, xlim = range(co[, 1]), ylim = range(co[, 2]), vertex.label.dist = 0, vertex.label.color = "red" ) axis(1) axis(2)