FAQs about using the layout algorithms

The following list of FAQs provides some helpful suggestions for using the layout algorithms. You might find some answers to questions that come up when using the graph layout package.
FAQs about the layout algorithms  
Question
Answer
I perform the layout and nothing happens (no node is moved). Why?
One possible reason can be: the layout algorithms provided in the product are all designed to do nothing, by default, if no change occurred in the graph since the last time the layout was performed successfully on the same graph. A change means that a node was moved, or a node or link was added, removed, or reshaped.
You can force the layout to be performed again, even if no change occurred, by calling the performLayout(force:Boolean = false, traverse:Boolean = false):int method with a true value for the force argument.
Another possible reason can be: an error or a special case occurred during the layout. First, you should check whether the performLayout() method has thrown an error. If no error was thrown, retrieve the code property on the instance of the layout report. Check this value with respect to the documentation of the appropriate layout report class. (For details, see Using a graph layout report.)
With the Force-directed algorithm in incremental mode, after having performed the layout once, I do not see any movement even if I use the force layout option. Why?
The reason is probably that the first time you performed the layout, the algorithm reached the convergence. When the layout is performed again, it detects that the convergence has been already reached and stops. If you really want to continue working, for instance to “declutter” a particular part of the graph, you might have to move one or several nodes to change the initial configuration. (The algorithm is dependent on the initial configuration.)
After performing the layout, the graph is laid out far from its initial position. Why?
Most of the layout algorithms use a layout region parameter to control the size and position of the layout. (For details, see Layout region.) Depending on the value of this parameter, the nodes can be moved far from their initial positions.
To know whether a layout algorithm is designed to use a layout region parameter, check the documentation to see if the layout class overrides the following method of the base class in order to return true:
Other algorithms have a different mechanism with which you can specify the location of the layout. It can happen that the default value of the location parameter is such that the graph is laid out far from its initial position.
When I use certain layout algorithms on certain graphs, there are overlapping nodes. Why and what can I do?
One possible reason can be related to the different ways layout algorithms deal with the size of the nodes:
- The Tree and Hierarchical algorithms always avoid overlapping nodes. (The Link algorithm does not move the nodes. It only reshapes the links such that the crossings and overlaps are reduced. The size of the nodes is taken into account.)
- The Force-directed algorithm (with the option “Respect Node Sizes” enabled) in many cases succeeds in avoiding overlapping nodes.
In any case, if the layout algorithm supports the layout region mechanism (see Layout region), try to increase the size of the layout region. For example, if your graph contains hundreds of nodes, it is not reasonable to use a small layout region, such as 600x600. There is not enough space for all the nodes. Try a larger layout region, for example 5000x5000.
The optimal size of the layout region depends not only on the number of nodes, but also on their size. If the nodes are relatively large with respect to the size of the layout region, it might be necessary to adjust some of the parameters (for example, the preferred link length for the Force-directed Layout).
In some networks, there are two (or more) subnetworks that are not connected. How does this affect the layout algorithms?
It depends on the layout class you use:
- ibm_ilog.graphlayout.forcedirected.ForceDirectedLayout: This algorithm supports disconnected graphs, but usually it is better to rely on the automatic “layout of connected components” parameter. (See Layout of connected components.)
- ibm_ilog.graphlayout.hierarchical.HierarchicalLayout and ibm_ilog.graphlayout.tree.TreeLayout: They have built-in support for disconnected graphs. Alternatively, you can use the automatic support from the base class. (See Layout of connected components.)
- ibm_ilog.graphlayout.longlink.LongLinkLayout, ibm_ilog.graphlayout.shortlink.ShortLinkLayout, ibm_ilog.graphlayout.grid.GridLayout, ibm_ilog.graphlayout.random.RandomLayout: These algorithms support both connected and disconnected graphs. Their behavior is the same for both categories of graphs.
There are some attributes of the network that we know about (for instance, we know what the core switch is and what the center must be). Are such attributes taken into account by the layout algorithm?
It depends on the layout algorithm.
- The Circular Layout is designed to allow you to specify information about the physical topology of the network. You can specify which nodes belong to the same cluster (ring or star), the order of the nodes on the cluster, and which node is the center of a star cluster.
- In the Tree Layout, you can specify the root node.
- In the Hierarchical Layout algorithm, you can specify node position indices and level indices, as well as relative positioning constraints.
If I use IBM ILOG Dojo Diagrammer on different computers with a different browser, I sometimes get different layouts for the same graph and with the same parameters. Why?
1. Different computers and browsers can be slower or faster. If the layout algorithm you use stops the computation when the specified allowed time has elapsed, a slower computer or browser causes the computation to stop earlier. It can explain different results. It can happen even with the same computer and browser if the load of the computer is increased. You might have to increase the allowed time specification when running on a slower computer or a different browser.
I use the Long and Short Link Layout algorithms to lay out the links of a network of graphical objects.
When several links connect to the same side of a node, they overlap, while I expect them to respect the “link offset” (or the “grid size”) parameter of the link layout.
Why?
Some dimensional parameters of the layout algorithms need to be chosen with respect to the size of the nodes. It is the case of the “link offset” and the “bypass distance” parameters for the Short Link Layout, and the grid size for the Long Link Layout. Indeed, their default values are not appropriate when the nodes are large. Compared to this size, the default values of the parameters are so small that they appear to be zero.
The solution is to increase the values of the dimensional parameters, taking into account the size of the nodes. If different nodes have different sizes, either the medium or the largest size of the nodes can be used to compute the parameters as a fraction of this size.