layout.auto(graph, dim=2, ...)
layout.random(graph, params, dim=2)
layout.circle(graph, params)
layout.sphere(graph, params)
layout.fruchterman.reingold(graph, ..., dim=2, params)
layout.kamada.kawai(graph, ..., dim=2, params)
layout.spring(graph, ..., params)
layout.reingold.tilford(graph, ..., params)
layout.fruchterman.reingold.grid(graph, ..., params)
layout.lgl(graph, ..., params)
layout.graphopt(graph, ..., params=list())
layout.svd(graph, d=shortest.paths(graph), ...)
layout.norm(layout, xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL,
zmin = NULL, zmax = NULL)
params
argument. For layout.auto
these
extra parameters are simply passed to the real layout function, if
one is called.NULL
then no normalization is performed along
this direction.NULL
then no normalization is performed along
this direction.NULL
then no normalization is performed along
this direction. layout.auto
tries to choose an appropriate layout function for
the supplied graph, and uses that to generate the layout. The current
implementations works like this:
layout.kamada.kawai
.layout.fruchterman.reingold
.layout.drl
is called.layout.random
simply places the vertices randomly on a
square. It has no parameters. layout.circle
places the vertices on a unit circle
equidistantly. It has no paramaters.
layout.sphere
places the vertices (approximately) uniformly on
the surface of a sphere, this is thus a 3d layout. It is not clear
however what layout.fruchterman.reingold
uses a force-based algorithm
proposed by Fruchterman and Reingold, see references. Parameters and
their default values:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
This function was ported from the SNA package.
layout.kamada.kawai
is another force based algorithm.
Parameters and default values:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
This function performs very well for connected graphs, but it gives
poor results for unconnected ones.
This function was ported from the SNA package.
layout.spring
is a spring embedder algorithm.
Parameters and default values:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
This function was ported from the SNA package.
layout.reingold.tilford
generates a tree-like layout, so it is
mainly for trees. Parameters and default values:
[object Object],[object Object],[object Object]
layout.fruchterman.reingold.grid
is similar to
layout.fruchterman.reingold
but repelling force is calculated
only between vertices that are closer to each other than a limit, so
it is faster. Patameters and default values:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
layout.lgl
is for large connected graphs, it is similar to the
layout generator of the Large Graph Layout software
(
layout.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.)
See also
Parameters and default values:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
layout.svd
is a currently experimental layout function based on
singular value decomposition. It does not have the usual params
argument, but take a single argument, the distance matrix of the
graph. This function generates the layout separately for each graph
component and then merges them via layout.merge
.
layout.norm
normalizes a layout, it linearly transforms each
coordinate separately to fit into the given limits.
layout.drl
is another force-driven layout generator, it is
suitable for quite large graphs. See layout.drl
for
details.
Kamada, T. and Kawai, S. (1989). An Algorithm for Drawing General Undirected Graphs. Information Processing Letters, 31(1):7-15.
Reingold, E and Tilford, J (1981). Tidier drawing of trees. IEEE Trans. on Softw. Eng., SE-7(2):223--228.
layout.drl
, plot.igraph
, tkplot
g <- graph.ring(10)
layout.random(g)
layout.kamada.kawai(g)
# Fixing ego
g <- ba.game(20, m=2)
minC <- rep(-Inf, vcount(g))
maxC <- rep(Inf, vcount(g))
minC[1] <- maxC[1] <- 0
co <- layout.fruchterman.reingold(g, minx=minC, maxx=maxC,
miny=minC, maxy=maxC)
co[1,]
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=1,
vertex.label.color="red")
axis(1)
axis(2)
Run the code above in your browser using DataLab