For using the igraph C library
igraph_layout_random
— Places the vertices uniform randomly on a plane.igraph_layout_circle
— Places the vertices uniformly on a circle, in the order of vertex ids.igraph_layout_star
— Generate a starlike layoutigraph_layout_grid
— Places the vertices on a regular grid on the plane.igraph_layout_graphopt
— Optimizes vertex layout via the graphopt algorithm.igraph_layout_bipartite
— Simple layout for bipartite graphsigraph_layout_fruchterman_reingold
— Places the vertices on a plane according to the FruchtermanReingold algorithm.igraph_layout_kamada_kawai
— Places the vertices on a plane according the KamadaKawai algorithm. igraph_layout_mds
— Place the vertices on a plane using multidimensional scaling.igraph_layout_grid_fruchterman_reingold
— Force based layout generator for large graphs.igraph_layout_lgl
— Force based layout algorithm for large graphs.igraph_layout_reingold_tilford
— ReingoldTilford layout for tree graphsigraph_layout_reingold_tilford_circular
— Circular ReingoldTilford layout for treesigraph_layout_sugiyama
— Sugiyama layout algorithm for layered directed acyclic graphs.Layout generator functions (or at least most of them) try to place the vertices and edges of a graph on a 2D plane or in 3D space in a way which visually pleases the human eye.
They take a graph object and a number of parameters as arguments and return an igraph_matrix_t, in which each row gives the coordinates of a vertex.
int igraph_layout_random(const igraph_t *graph, igraph_matrix_t *res);
Arguments:

Pointer to an initialized graph object. 

Pointer to an initialized matrix object. This will contain the result and will be resized as needed. 
Returns:
Error code. The current implementation always returns with success. 
Time complexity: O(V), the number of vertices.
int igraph_layout_circle(const igraph_t *graph, igraph_matrix_t *res);
Arguments:

Pointer to an initialized graph object. 

Pointer to an initialized matrix object. This will contain the result and will be resized as needed. 
Returns:
Error code. 
Time complexity: O(V), the number of vertices.
int igraph_layout_star(const igraph_t *graph, igraph_matrix_t *res, igraph_integer_t center, const igraph_vector_t *order);
Arguments:

The input graph. 

Pointer to an initialized matrix object. This will contain the result and will be resized as needed. 

The id of the vertex to put in the center. 

A numeric vector giving the order of the vertices (including the center vertex!). If a null pointer, then the vertices are placed in increasing vertex id order. 
Returns:
Error code. 
Time complexity: O(V), linear in the number of vertices.
See also:

int igraph_layout_grid(const igraph_t *graph, igraph_matrix_t *res, long int width);
Arguments:

Pointer to an initialized graph object. 

Pointer to an initialized matrix object. This will contain the result and will be resized as needed. 

The number of vertices in a single row of the grid. When zero or negative, the width of the grid will be the square root of the number of vertices, rounded up if needed. 
Returns:
Error code. The current implementation always returns with success. 
Time complexity: O(V), the number of vertices.
int igraph_layout_graphopt(const igraph_t *graph, igraph_matrix_t *res, igraph_integer_t niter, igraph_real_t node_charge, igraph_real_t node_mass, igraph_real_t spring_length, igraph_real_t spring_constant, igraph_real_t max_sa_movement, igraph_bool_t use_seed);
This 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 unnecessary 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 http://www.schmuhl.org/graphopt/ for the original graphopt.
Arguments:

The input graph. 

Pointer to an initialized matrix, the result will be stored here
and its initial contents is used the starting point of the simulation
if the 

Integer constant, 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 

The charge of the vertices, used to calculate electric repulsion. The original graphopt default is 0.001. 

The mass of the vertices, used for the spring forces. The original graphopt defaults to 30. 

The length of the springs, an integer number. The original graphopt defaults to zero. 

The spring constant, the original graphopt defaults to one. 

Real constant, it gives the maximum amount of movement allowed in a single step along a single axis. The original graphopt default is 5. 

Logical scalar, whether to use the positions in 
Returns:
Error code. 
Time complexity: O(n (V^2+E) ), n is the number of iterations,
V is the number of vertices, E the number
of edges. If node_charge
is zero then it is only O(nE).
int igraph_layout_bipartite(const igraph_t *graph, const igraph_vector_bool_t *types, igraph_matrix_t *res, igraph_real_t hgap, igraph_real_t vgap, long int maxiter);
The layout is created by first placing the vertices in two rows,
according to their types. Then the positions within the rows are
optimized to minimize edge crossings, by calling igraph_layout_sugiyama()
.
Arguments:

The input graph. 

A boolean vector containing ones and zeros, the vertex types. Its length must match the number of vertices in the graph. 

Pointer to an initialized matrix, the result, the x and y coordinates are stored here. 

The preferred minimum horizontal gap between vertices in the same layer (i.e. vertices of the same type). 

The distance between layers. 

Maximum number of iterations in the crossing minimization stage. 100 is a reasonable default; if you feel that you have too many edge crossings, increase this. 
Returns:
Error code. 
See also:
igraph_layout_drl_options_t
— Parameters for the DrL layout generatorigraph_layout_drl_default_t
— Predefined parameter templates for the DrL layout generatorigraph_layout_drl_options_init
— Initialize parameters for the DrL layout generatorigraph_layout_drl
— The DrL layout generatorigraph_layout_drl_3d
— The DrL layout generator, 3d version.DrL is a sophisticated layout generator developed and implemented by Shawn Martin et al. As of October 2012 the original DrL homepage is unfortunately not available. You can read more about this algorithm in the following technical report: Martin, S., Brown, W.M., Klavans, R., Boyack, K.W., DrL: Distributed Recursive (Graph) Layout. SAND Reports, 2008. 2936: p. 110.
Only a subset of the complete DrL functionality is included in igraph, parallel runs and recursive, multilevel layouting is not supported.
The parameters of the layout are stored in an igraph_layout_drl_options_t
structure, this can be initialized by
calling the function igraph_layout_drl_options_init()
.
The fields of this structure can then be adjusted by hand if needed.
The layout is calculated by an igraph_layout_drl()
call.
typedef struct igraph_layout_drl_options_t { igraph_real_t edge_cut; igraph_integer_t init_iterations; igraph_real_t init_temperature; igraph_real_t init_attraction; igraph_real_t init_damping_mult; igraph_integer_t liquid_iterations; igraph_real_t liquid_temperature; igraph_real_t liquid_attraction; igraph_real_t liquid_damping_mult; igraph_integer_t expansion_iterations; igraph_real_t expansion_temperature; igraph_real_t expansion_attraction; igraph_real_t expansion_damping_mult; igraph_integer_t cooldown_iterations; igraph_real_t cooldown_temperature; igraph_real_t cooldown_attraction; igraph_real_t cooldown_damping_mult; igraph_integer_t crunch_iterations; igraph_real_t crunch_temperature; igraph_real_t crunch_attraction; igraph_real_t crunch_damping_mult; igraph_integer_t simmer_iterations; igraph_real_t simmer_temperature; igraph_real_t simmer_attraction; igraph_real_t simmer_damping_mult; } igraph_layout_drl_options_t;
Values:

The edge cutting parameter. Edge cutting is done in the late stages of the algorithm in order to achieve less dense layouts. Edges are cut if there is a lot of stress on them (a large value in the objective function sum). The edge cutting parameter is a value between 0 and 1 with 0 representing no edge cutting and 1 representing maximal edge cutting. The default value is 32/40. 

Number of iterations, initial phase. 

Start temperature, initial phase. 

Attraction, initial phase. 

Damping factor, initial phase. 

Number of iterations in the liquid phase. 

Start temperature in the liquid phase. 

Attraction in the liquid phase. 

Multiplicatie damping factor, liquid phase. 

Number of iterations in the expansion phase. 

Start temperature in the expansion phase. 

Attraction, expansion phase. 

Damping factor, expansion phase. 

Number of iterations in the cooldown phase. 

Start temperature in the cooldown phase. 

Attraction in the cooldown phase. 

Damping fact int the cooldown phase. 

Number of iterations in the crunch phase. 

Start temperature in the crunch phase. 

Attraction in the crunch phase. 

Damping factor in the crunch phase. 

Number of iterations in the simmer phase. 

Start temperature in te simmer phase. 

Attraction in the simmer phase. 

Multiplicative damping factor in the simmer phase. 
typedef enum { IGRAPH_LAYOUT_DRL_DEFAULT=0, IGRAPH_LAYOUT_DRL_COARSEN, IGRAPH_LAYOUT_DRL_COARSEST, IGRAPH_LAYOUT_DRL_REFINE, IGRAPH_LAYOUT_DRL_FINAL } igraph_layout_drl_default_t;
These constants can be used to initialize a set of DrL parameters. These can then be modified according to the user's needs.
Values:

The deafult parameters. 

Slightly modified parameters to get a coarser layout. 

An even coarser layout. 

Refine an already calculated layout. 

Finalize an already refined layout. 
int igraph_layout_drl_options_init(igraph_layout_drl_options_t *options, igraph_layout_drl_default_t templ);
This function can be used to initialize the struct holding the parameters for the DrL layout generator. There are a number of predefined templates available, it is a good idea to start from one of these by modifying some parameters.
Arguments:

The struct to initialize. 

The template to use. Currently the following templates
are supplied: 
Returns:
Error code. 
Time complexity: O(1).
int igraph_layout_drl(const igraph_t *graph, igraph_matrix_t *res, igraph_bool_t use_seed, igraph_layout_drl_options_t *options, const igraph_vector_t *weights, const igraph_vector_bool_t *fixed);
This function implements the forcedirected DrL layout generator. Please see more in the following technical report: Martin, S., Brown, W.M., Klavans, R., Boyack, K.W., DrL: Distributed Recursive (Graph) Layout. SAND Reports, 2008. 2936: p. 110.
Arguments:

The input graph. 

Logical scalar, if true, then the coordinates
supplied in the 

Pointer to a matrix, the result layout is stored here. It will be resized as needed. 

The parameters to pass to the layout generator. 

Edge weights, pointer to a vector. If this is a null pointer then every edge will have the same weight. 

Pointer to a logical vector, or a null pointer. This
can be used to fix the position of some vertices. Vertices for
which it is true will not be moved, but stay at the coordinates
given in the 
Returns:
Error code. 
Time complexity: ???.
int igraph_layout_drl_3d(const igraph_t *graph, igraph_matrix_t *res, igraph_bool_t use_seed, igraph_layout_drl_options_t *options, const igraph_vector_t *weights, const igraph_vector_bool_t *fixed);
This function implements the forcedirected DrL layout generator. Please see more in the technical report: Martin, S., Brown, W.M., Klavans, R., Boyack, K.W., DrL: Distributed Recursive (Graph) Layout. SAND Reports, 2008. 2936: p. 110.
This function uses a modified DrL generator that does the layout in three dimensions.
Arguments:

The input graph. 

Logical scalar, if true, then the coordinates
supplied in the 

Pointer to a matrix, the result layout is stored here. It will be resized as needed. 

The parameters to pass to the layout generator. 

Edge weights, pointer to a vector. If this is a null pointer then every edge will have the same weight. 

Pointer to a logical vector, or a null pointer. This
can be used to fix the position of some vertices. Vertices for
which it is true will not be moved, but stay at the coordinates
given in the 
Returns:
Error code. 
Time complexity: ???.
See also:

int igraph_layout_fruchterman_reingold(const igraph_t *graph, igraph_matrix_t *res, igraph_integer_t niter, igraph_real_t maxdelta, igraph_real_t area, igraph_real_t coolexp, igraph_real_t repulserad, igraph_bool_t use_seed, const igraph_vector_t *weight, const igraph_vector_t *minx, const igraph_vector_t *maxx, const igraph_vector_t *miny, const igraph_vector_t *maxy);
This is a forcedirected layout, see Fruchterman, T.M.J. and Reingold, E.M.: Graph Drawing by Forcedirected Placement. Software  Practice and Experience, 21/11, 11291164, 1991. This function was ported from the SNA R package.
Arguments:

Pointer to an initialized graph object. 

Pointer to an initialized matrix object. This will contain the result and will be resized as needed. 

The number of iterations to do. A reasonable default value is 500. 

The maximum distance to move a vertex in an iteration. A reasonable default value is the number of vertices. 

The area parameter of the algorithm. A reasonable default is the square of the number of vertices. 

The cooling exponent of the simulated annealing. A reasonable default is 1.5. 

Determines the radius at which
vertexvertex repulsion cancels out attraction of
adjacent vertices. A reasonable default is 

Logical, if true the supplied values in the


Pointer to a vector containing edge weights, the attraction along the edges will be multiplied by these. It will be ignored if it is a nullpointer. 

Pointer to a vector, or a 

Same as 

Pointer to a vector, or a 

Same as 
Returns:
Error code. 
Time complexity: O(V^2) in each iteration, V is the number of vertices in the graph.
int igraph_layout_kamada_kawai(const igraph_t *graph, igraph_matrix_t *res, igraph_integer_t niter, igraph_real_t sigma, igraph_real_t initemp, igraph_real_t coolexp, igraph_real_t kkconst, igraph_bool_t use_seed, const igraph_vector_t *minx, const igraph_vector_t *maxx, const igraph_vector_t *miny, const igraph_vector_t *maxy);
This is a force directed layout, see Kamada, T. and Kawai, S.: An Algorithm for Drawing General Undirected Graphs. Information Processing Letters, 31/1, 715, 1989. This function was ported from the SNA R package.
Arguments:

A graph object. 

Pointer to an initialized matrix object. This will contain the result (xpositions in column zero and ypositions in column one) and will be resized if needed. 

The number of iterations to perform. A reasonable default value is 1000. 

Sets the base standard deviation of position change proposals. A reasonable default value is the number of vertices / 4. 

Sets the initial temperature for the annealing. A reasonable default value is 10. 

The cooling exponent of the annealing. A reasonable default value is 0.99. 

The KamadaKawai vertex attraction constant. Typical value: (number of vertices)^2 

Boolean, whether to use the values supplied in the


Pointer to a vector, or a 

Same as 

Pointer to a vector, or a 

Same as 
Returns:
Error code. 
Time complexity: O(V^2) for each iteration, V is the number of vertices in the graph.
int igraph_layout_mds(const igraph_t* graph, igraph_matrix_t *res, const igraph_matrix_t *dist, long int dim, igraph_arpack_options_t *options);
This layout requires a distance matrix, where the intersection of row i and column j specifies the desired distance between vertex i and vertex j. The algorithm will try to place the vertices in a space having a given number of dimensions in a way that approximates the distance relations prescribed in the distance matrix. igraph uses the classical multidimensional scaling by Torgerson; for more details, see Cox & Cox: Multidimensional Scaling (1994), Chapman and Hall, London.
If the input graph is disconnected, igraph will decompose it
first into its subgraphs, lay out the subgraphs one by one
using the appropriate submatrices of the distance matrix, and
then merge the layouts using igraph_layout_merge_dla
.
Since igraph_layout_merge_dla
works for 2D layouts only,
you cannot run the MDS layout on disconnected graphs for
more than two dimensions.
Arguments:

A graph object. 

Pointer to an initialized matrix object. This will contain the result and will be resized if needed. 

The distance matrix. It must be symmetric and this function does not check whether the matrix is indeed symmetric. Results are unspecified if you pass a nonsymmetric matrix here. You can set this parameter to null; in this case, the shortest path lengths between vertices will be used as distances. 

The number of dimensions in the embedding space. For 2D layouts, supply 2 here. 

This argument is currently ignored, it was used for ARPACK, but LAPACK is used now for calculating the eigenvectors. 
Returns:
Error code. 
Added in version 0.6.
Time complexity: usually around O(V^2 dim).
int igraph_layout_grid_fruchterman_reingold(const igraph_t *graph, igraph_matrix_t *res, igraph_integer_t niter, igraph_real_t maxdelta, igraph_real_t area, igraph_real_t coolexp, igraph_real_t repulserad, igraph_real_t cellsize, igraph_bool_t use_seed, const igraph_vector_t *weight);
This algorithm is the same as the FruchtermanReingold layout generator, but it partitions the 2d space to a grid and and vertex repulsion is calculated only for vertices nearby.
Arguments:

The graph object. 

The result, the coordinates in a matrix. The parameter should point to an initialized matrix object and will be resized. 

The number of iterations to do. A reasonable default value is 500. 

The maximum distance to move a vertex in an iteration. A reasonable default value is the number of vertices. 

The area parameter of the algorithm. A reasonable default is the square of the number of vertices. 

The cooling exponent of the simulated annealing. A reasonable default is 1.5. 

Determines the radius at which
vertexvertex repulsion cancels out attraction of
adjacent vertices. A reasonable default is 

The size of the grid cells. A reasonable default is
the fourth root of 

Logical, if true, the coordinates passed in 

Pointer to a vector containing edge weights, the attraction along the edges will be multiplied by these. It will be ignored if it is a nullpointer. 
Returns:
Error code. 
Added in version 0.2.
Time complexity: ideally (constant number of vertices in each cell) O(niter*(V+E)), in the worst case O(niter*(V^2+E)).
int igraph_layout_lgl(const igraph_t *graph, igraph_matrix_t *res, igraph_integer_t maxit, igraph_real_t maxdelta, igraph_real_t area, igraph_real_t coolexp, igraph_real_t repulserad, igraph_real_t cellsize, igraph_integer_t proot);
This is a layout generator similar to the Large Graph Layout algorithm and program (http://lgl.sourceforge.net/). But unlike LGL, this version uses a FruchtermanReingold style simulated annealing algorithm for placing the vertices. The speedup is achieved by placing the vertices on a grid and calculating the repulsion only for vertices which are closer to each other than a limit.
Arguments:

The (initialized) graph object to place. 

Pointer to an initialized matrix object to hold the result. It will be resized if needed. 

The maximum number of cooling iterations to perform for each layout step. A reasonable default is 150. 

The maximum length of the move allowed for a vertex in a single iteration. A reasonable default is the number of vertices. 

This parameter gives the area of the square on which the vertices will be placed. A reasonable default value is the number of vertices squared. 

The cooling exponent. A reasonable default value is 1.5. 

Determines the radius at which vertexvertex
repulsion cancels out attraction of adjacent vertices. A
reasonable default value is 

The size of the grid cells, one side of the
square. A reasonable default value is the fourth root of


The root vertex, this is placed first, its neighbors in the first iteration, second neighbors in the second, etc. If negative then a random vertex is chosen. 
Returns:
Error code. 
Added in version 0.2.
Time complexity: ideally O(dia*maxit*(V+E)), V is the number of vertices, dia is the diameter of the graph, worst case complexity is still O(dia*maxit*(V^2+E)), this is the case when all vertices happen to be in the same grid cell.
int igraph_layout_reingold_tilford(const igraph_t *graph, igraph_matrix_t *res, igraph_neimode_t mode, const igraph_vector_t *roots, const igraph_vector_t *rootlevel);
Arranges the nodes in a tree where the given node is used as the root. The tree is directed downwards and the parents are centered above its children. For the exact algorithm, see:
Reingold, E and Tilford, J: Tidier drawing of trees. IEEE Trans. Softw. Eng., SE7(2):223228, 1981
If the given graph is not a tree, a breadthfirst search is executed first to obtain a possible spanning tree.
Arguments:

The graph object. 

The result, the coordinates in a matrix. The parameter should point to an initialized matrix object and will be resized. 

Specifies which edges to consider when building the tree.
If it is 

The index of the root vertex or root vertices.
If this is a nonempty vector then the supplied vertex ids are used
as the roots of the trees (or a single tree if the graph is connected).
If it is a null pointer of a pointer to an empty vector, then the root
vertices are automatically calculated based on topological sorting,
performed with the opposite mode than the 

This argument can be useful when drawing forests which are
not trees (i.e. they are unconnected and have tree components). It specifies
the level of the root vertices for every tree in the forest. It is only
considered if not a null pointer and the 
Returns:
Error code. 
Added in version 0.2.
See also:
Example 18.1. File examples/simple/igraph_layout_reingold_tilford.c
/* * mode: C * */ /* IGraph library. Copyright (C) 20062012 Gabor Csardi <csardi.gabor@gmail.com> 334 Harvard st, Cambridge MA, 02139 USA This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 021101301 USA */ #include <igraph.h> #include <math.h> int main() { igraph_t g; FILE *f; igraph_matrix_t coords; /* long int i, n; */ f=fopen("igraph_layout_reingold_tilford.in", "r"); igraph_read_graph_edgelist(&g, f, 0, 1); igraph_matrix_init(&coords, 0, 0); igraph_layout_reingold_tilford(&g, &coords, IGRAPH_IN, 0, 0); /*n=igraph_vcount(&g); for (i=0; i<n; i++) { printf("%6.3f %6.3f\n", MATRIX(coords, i, 0), MATRIX(coords, i, 1)); }*/ igraph_matrix_destroy(&coords); igraph_destroy(&g); return 0; }
int igraph_layout_reingold_tilford_circular(const igraph_t *graph, igraph_matrix_t *res, igraph_neimode_t mode, const igraph_vector_t *roots, const igraph_vector_t *rootlevel);
This layout is almost the same as igraph_layout_reingold_tilford()
, but
the tree is drawn in a circular way, with the root vertex in the center.
Arguments:

The graph object. 

The result, the coordinates in a matrix. The parameter should point to an initialized matrix object and will be resized. 

Specifies which edges to consider when building the tree.
If it is 

The index of the root vertex or root vertices.
If this is a nonempty vector then the supplied vertex ids are used
as the roots of the trees (or a single tree if the graph is connected).
If it is a null pointer of a pointer to an empty vector, then the root
vertices are automatically calculated based on topological sorting,
performed with the opposite mode than the 

This argument can be useful when drawing forests which are
not trees (i.e. they are unconnected and have tree components). It specifies
the level of the root vertices for every tree in the forest. It is only
considered if not a null pointer and the 
Returns:
Error code. 
See also:
int igraph_layout_sugiyama(const igraph_t *graph, igraph_matrix_t *res, igraph_t *extd_graph, igraph_vector_t *extd_to_orig_eids, const igraph_vector_t* layers, igraph_real_t hgap, igraph_real_t vgap, long int maxiter, const igraph_vector_t *weights);
This layout algorithm is designed for directed acyclic graphs where each vertex is assigned to a layer. Layers are indexed from zero, and vertices of the same layer will be placed on the same horizontal line. The X coordinates of vertices within each layer are decided by the heuristic proposed by Sugiyama et al to minimize edge crossings.
You can also try to lay out undirected graphs, graphs containing cycles, or graphs without an a priori layered assignment with this algorithm. igraph will try to eliminate cycles and assign vertices to layers, but there is no guarantee on the quality of the layout in such cases.
The Sugiyama layout may introduce "bends" on the edges in order to obtain a visually more pleasing layout. This is achieved by adding dummy nodes to edges spanning more than one layer. The resulting layout assigns coordinates not only to the nodes of the original graph but also to the dummy nodes. The layout algorithm will also return the extended graph with the dummy nodes. An edge in the original graph may either be mapped to a single edge in the extended graph or a path that starts and ends in the original source and target vertex and passes through multiple dummy vertices. In such cases, the user may also request the mapping of the edges of the extended graph back to the edges of the original graph.
For more details, see K. Sugiyama, S. Tagawa and M. Toda, "Methods for Visual Understanding of Hierarchical Systems". IEEE Transactions on Systems, Man and Cybernetics 11(2):109125, 1981.
Arguments:

Pointer to an initialized graph object. 

Pointer to an initialized matrix object. This will contain
the result and will be resized as needed. The first V rows
of the layout will contain the coordinates of the original graph,
the remaining rows contain the positions of the dummy nodes.
Therefore, you can use the result both with 

Pointer to an uninitialized graph object or 

Pointer to a vector or 

The layer index for each vertex or 

The preferred minimum horizontal gap between vertices in the same layer. 

The distance between layers. 

Maximum number of iterations in the crossing minimization stage. 100 is a reasonable default; if you feel that you have too many edge crossings, increase this. 

Weights of the edges. These are used only if the graph contains cycles; igraph will tend to reverse edges with smaller weights when breaking the cycles. 
igraph_layout_random_3d
— Random layout in 3Digraph_layout_sphere
— Places vertices (more or less) uniformly on a sphere.igraph_layout_grid_3d
— Places the vertices on a regular grid in the 3D space.igraph_layout_fruchterman_reingold_3d
— 3D FruchtermanReingold algorithm.igraph_layout_kamada_kawai_3d
— 3D version of the force based KamadaKawai layout.
int igraph_layout_random_3d(const igraph_t *graph, igraph_matrix_t *res);
Arguments:

The graph to place. 

Pointer to an initialized matrix object. It will be resized to hold the result. 
Returns:
Error code. The current implementation always returns with success. 
Added in version 0.2.
Time complexity: O(V), the number of vertices.
int igraph_layout_sphere(const igraph_t *graph, igraph_matrix_t *res);
The algorithm was described in the following paper: Distributing many points on a sphere by E.B. Saff and A.B.J. Kuijlaars, Mathematical Intelligencer 19.1 (1997) 511.
Arguments:

Pointer to an initialized graph object. 

Pointer to an initialized matrix object. This will contain the result and will be resized as needed. 
Returns:
Error code. The current implementation always returns with success. 
Added in version 0.2.
Time complexity: O(V), the number of vertices in the graph.
int igraph_layout_grid_3d(const igraph_t *graph, igraph_matrix_t *res, long int width, long int height);
Arguments:

Pointer to an initialized graph object. 

Pointer to an initialized matrix object. This will contain the result and will be resized as needed. 

The number of vertices in a single row of the grid. When zero or negative, the width is determined automatically. 

The number of vertices in a single column of the grid. When zero or negative, the height is determined automatically. 
Returns:
Error code. The current implementation always returns with success. 
Time complexity: O(V), the number of vertices.
int igraph_layout_fruchterman_reingold_3d(const igraph_t *graph, igraph_matrix_t *res, igraph_integer_t niter, igraph_real_t maxdelta, igraph_real_t volume, igraph_real_t coolexp, igraph_real_t repulserad, igraph_bool_t use_seed, const igraph_vector_t *weight, const igraph_vector_t *minx, const igraph_vector_t *maxx, const igraph_vector_t *miny, const igraph_vector_t *maxy, const igraph_vector_t *minz, const igraph_vector_t *maxz);
This is the 3D version of the force based
FruchtermanReingold layout (see igraph_layout_fruchterman_reingold
for the 2D version
This function was ported from the SNA R package.
Arguments:

Pointer to an initialized graph object. 

Pointer to an initialized matrix object. This will contain the result and will be resized as needed. 

The number of iterations to do. A reasonable default value is 500. 

The maximum distance to move a vertex in an iteration. A reasonable default value is the number of vertices. 

The volume parameter of the algorithm. A reasonable default is the number of vertices^3. 

The cooling exponent of the simulated annealing. A reasonable default is 1.5. 

Determines the radius at which
vertexvertex repulsion cancels out attraction of
adjacent vertices. A reasonable default is 

Logical, if true the supplied values in the


Pointer to a vector containing edge weights, the attraction along the edges will be multiplied by these. It will be ignored if it is a nullpointer. 

Pointer to a vector, or a 

Same as 

Pointer to a vector, or a 

Same as 

Pointer to a vector, or a 

Same as 
Returns:
Error code. 
Added in version 0.2.
Time complexity: O(V^2) in each iteration, V is the number of vertices in the graph.
int igraph_layout_kamada_kawai_3d(const igraph_t *graph, igraph_matrix_t *res, igraph_integer_t niter, igraph_real_t sigma, igraph_real_t initemp, igraph_real_t coolexp, igraph_real_t kkconst, igraph_bool_t use_seed, igraph_bool_t fixz, const igraph_vector_t *minx, const igraph_vector_t *maxx, const igraph_vector_t *miny, const igraph_vector_t *maxy, const igraph_vector_t *minz, const igraph_vector_t *maxz);
The pair of the igraph_layout_kamada_kawai
2D layout generator
This function was ported from the SNA R package.
Arguments:

A graph object. 

Pointer to an initialized matrix object. This will contain the result and will be resized if needed. 

The number of iterations to perform. A reasonable default value is 1000. 

Sets the base standard deviation of position change proposals. A reasonable default value is the number of vertices / 4. 

Sets the initial temperature for the annealing. A reasonable default value is 10. 

The cooling exponent of the annealing. A reasonable default value is 0.99. 

The KamadaKawai vertex attraction constant. Typical value: (number of vertices)^2 

Boolean, whether to use the values cupplied in the 

Logical, whether to fix the third coordinate of the input matrix. 
Returns:
Error code. 
Added in version 0.2.
Time complexity: O(V^2) for each iteration, V is the number of vertices in the graph.
int igraph_layout_merge_dla(igraph_vector_ptr_t *thegraphs, igraph_vector_ptr_t *coords, igraph_matrix_t *res);
First each layout is covered by a circle. Then the layout of the largest graph is placed at the origin. Then the other layouts are placed by the DLA algorithm, larger ones first and smaller ones last.
Arguments:

Pointer vector containing the graph object of which the layouts will be merged. 

Pointer vector containing matrix objects with the 2d
layouts of the graphs in 

Pointer to an initialized matrix object, the result will be stored here. It will be resized if needed. 
Returns:
Error code. 
Added in version 0.2. This function is experimental.
Time complexity: TODO.
← Chapter 17. Graph Motifs, Dyad Census and Triad Census  Chapter 19. Reading and Writing Graphs from and to Files → 