Chapter 5. Graph Layout

Laying out graphs automatically in Rocs

Rocs can lay out graphs automatically. The Rocs graph layout tool can be found in the main menu at Graph DocumentToolsGraph Layout. There are two different layout algorithms that can be applied: Force Based Layout and Radial Tree Layout. To apply one of them, select the corresponding tab of the graph layout tool, choose the desired parameters and execute the algorithm by pressing on the OK button. Details that are specific to each one of the layout algorithms are provided in the next sections.

Force Based Layout

The Force Based Layout can be applied to any graph. Intuitively, this algorithm simulates forces acting in each node. There are repelling forces between pairs of nodes and attraction forces between pairs of nodes that are neighbours. The magnitude of these forces can be specified by moving the corresponding sliders in the user interface.

A Screenshot of the Force Based Layout tab of the Rocs graph layout tool.

Another parameter that can be controlled is the Area Factor. This parameter controls how the nodes are spread. Layouts generated with high values of Area Factor have a tendency of having large distances between nodes.

Radial Tree Layout

The Radial Tree Layout can only be applied to trees. Any attempt to apply this layout algorithm to other kinds of graph will produce an error message. Parameters for the Radial Tree Layout can be selected using the provided user interface.

A Screenshot of the Radial Tree Layout tab of the Rocs graph layout tool.

The tree type parameter selects between a free tree layout and a rooted tree layout. In a free tree layout, nodes are placed freely without any apparent hierarchy between them. In a rooted tree layout, the root node is placed at the top and sub-trees are laid out below it, giving an idea of a hierarchy between nodes.

The center/root parameter defines which node is going be used as root for the rooted tree layout or as center for the free tree layout. The center of a free tree layout is the first node to be placed by the algorithm. All other nodes are placed on circles centered at the center node. A center/root can be selected automatically by the layout algorithm.

The node separation parameter controls the distance between nodes. Increasing the value of this parameter will cause the distance between nodes to increase. Similarly, decreasing the value of this parameter will cause the distance between nodes to decrease.