The Hierarchical Layout algorithm supports relative position constraints on
nodes. Such a constraint
is a rule on how a particular node (or a group of nodes) must be placed
with respect to the other nodes. The constraints influence the relative
positions. For example, you can force node
A
to
be on the left side of node B
, so the position
of A
is expressed relative to the position
of B
. It is theoretically possible to specify
contradicting constraints: if you specify that node A
must
be on the left side of B
and B
must
be on the left side of A
, then these constraints
are not solvable at the same time. If A
is
on the left side of B
, then B
must
be on the right side of A
. The Hierarchical
Layout algorithm tries to detect and resolve constraint conflicts
automatically. It ignores those constraints that are infeasible. Since
the automatic constraint resolution is time consuming, it is recommended
to specify nonconflicting constraints when possible. Constraints must be used only if the incremental mode
is disabled. In fact, the incremental mode is implemented with additional
constraints that are added internally. Hence, if you use constraints
during the incremental mode, it is likely that the system detects
so many constraint conflicts that you get unexpected results.
Constraints must be used carefully. The more constraints
are specified, the more difficult it is to calculate a layout. Therefore,
this resulting layout can have more link crossings and be less balanced
than a graph with no constraints.
Each type of constraint is represented by a subclass
of ibm_ilog.graphlayout.hierarchical.HierarchicalConstraint. The following constraint types
are available:
ibm_ilog.graphlayout.hierarchical.HierarchicalLevelRangeConstraint |
Forces a node into a range of certain levels |
ibm_ilog.graphlayout.hierarchical.HierarchicalSameLevelConstraint |
Forces two nodes to the same level. |
ibm_ilog.graphlayout.hierarchical.HierarchicalRelativeLevelConstraint |
Forces a node to a lower/higher level than
another node. |
ibm_ilog.graphlayout.hierarchical.HierarchicalGroupSpreadConstraint |
Forces a group of nodes on levels that are
no more than a specified spread value apart. |
ibm_ilog.graphlayout.hierarchical.HierarchicalRelativePositionConstraint |
Forces a node to a lower/higher position than
another node of the same level. |
ibm_ilog.graphlayout.hierarchical.HierarchicalSideBySideConstraint |
Forces two nodes of the same level to be placed
side by side. |
ibm_ilog.graphlayout.hierarchical.HierarchicalExtremityConstraint |
Forces a node to the first or last level,
or to the first or last position within a level. |
ibm_ilog.graphlayout.hierarchical.HierarchicalSwimLaneConstraint |
Forces a group of nodes into the same rectangular
swimlane area. |
Note
When hierarchical layout is used to layout nodes and
links in a Diagram component that
contains swimlane objects (ibm_ilog.graphlayout.SwimLane instances),
ibm_ilog.graphlayout.hierarchical.HierarchicalLayout.HierarchicalSwinLaneConstraint instances are automatically
created to place the swimlane child objects in the same swimlane area,
and to correctly size the swimlanes.