ibm_ilog.graphlayout.forcedirected
Method Summary
- ForceDirectedLayout(a0) The main class for the Force-Directed Layout algorithm.
- ForceDirectedLayoutReport() The class used to store information about the behavior of the ' ForceDirectedLayout'.
Attached Objects
Methods
The main class for the Force-Directed Layout algorithm.
The Force-Directed Layout algorithm can be used to lay out any type of graph. It often provides a drawing with no, or only a few, edge crossings and with approximately equal-length edges for small- and medium-size graphs having a small number of cycles.
This layout algorithm iteratively searches for a configuration of the graph such that the lengths of the edges are close to a desired value.
Here are sample drawings produced with the Force-Directed Layout algorithm:
Performance hints
Several parameters have an impact on speed. In some extent, the performance can be improved by modifying these parameters.
- Parameter with the largest impact on speed:
ForceDirectedLayout.setLayoutMode()
. The algorithm provides three modes with different tradeoffs between quality and speed. For details, please refer to documentation of this method.
- Parameters that allow to reduce the number of iterations that are
executed:
ForceDirectedLayout.setPreferredLinksLength()
. The algorithm stops iterating when the length of all links is close to the specified "preferredLinksLength" parameter. If the preferred length is very high while the initial length of the links is small, reducing the preferred length is an indirect way to reduce the necessary number of iterations, hence to speed up.ibm_ilog.graphlayout.GraphLayout.setAllowedTime()
. Reducing the allowed time is a way to force the completion of the layout quicker. However, the quality gets of course worst.ForceDirectedLayout.setAllowedNumberOfIterations()
. Similar as foribm_ilog.graphlayout.GraphLayout.setAllowedTime()
.
- Parameters that allow to reduce the time spent on each iteration:
ForceDirectedLayout.setRespectNodeSizes()
. If disabled, the algorithm is a bit quicker because it does not try to avoid overlaps between nodes. This is in particular possible, without quality degradation, when all the nodes have approximately the same size and have more or less a square shape. In such cases, specifying a "preferredLinksLength" high enough usually avoids overlaps even if "respectNodeSizes" is not enabled.ForceDirectedLayout.setMaxAllowedMovePerIteration()
. This indicates the maximum distance the algorithm is allowed to move a node at each iteration. The higher the value, quicker the optimum may be reached, but also the algorithm may fail to converge (no "crash", just that the quality may be worst).
See the corresponding chapter of the IBM ILOG Dojo Diagrammer User's Manual for details on the algorithm, the types of graphs for which this algorithm can be used, the features and limitations, code samples, parameters, and so on.
You can specify a preferred length for the links globally ( ForceDirectedLayout.setPreferredLinksLength()
or for specific links ( ForceDirectedLayout.setPreferredLength()
).
You can request that the real size of the nodes is taken into account ( ForceDirectedLayout.setRespectNodeSizes()
). This is especially recommended when the nodes are not square (have a larger or smaller width than height), or have different sizes. In such a case, the layout quality can be often further improved by increasing the weight of the node repulsion force (see ForceDirectedLayout.setAdditionalNodeRepulsionWeight()
; the default is zero).
While the layout algorithm optionally restricts the region where the nodes are placed (see ForceDirectedLayout.setForceFitToLayoutRegion()
), the layout quality is usually much better if this option is not used (this is the default behavior).
If this option is not set, the nodes are considered to be points located in the center of the bounding box of the nodes. Using the layout algorithm without setting this option is recommended when the width of the nodes is close to their height and there are no significant size differences among the nodes.
Note that, in the incremental mode (which is the default), the initial position of the nodes (at the moment you start the layout) is taken into account by the layout algorithm, so you may get different results depending on the initial position.
Parameter | Type | Description |
---|---|---|
a0 |