1.6. igraph_layout_reingold_tilford — Reingold-Tilford layout for tree graphs

int igraph_layout_reingold_tilford(const igraph_t *graph, 
				   igraph_matrix_t *res, long int root);

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., SE-7(2):223--228, 1981

If the given graph is not a tree, a breadth-first search is executed first to obtain a possible spanning tree.

Arguments: 

graph:

The graph object.

res:

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

root:

The index of the root vertex.

Returns: 

Error code.

Added in version 0.2.

TODO: decompose and merge for not fully connected graphs TODO: possible speedup could be achieved if we use a table for storing the children of each node in the tree. (Now the implementation uses a single array containing the parent of each node and a node's children are determined by looking for other nodes that have this node as parent)

See also: 

igraph_layout_reingold_tilford_circular().