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
IlvHierarchicalConstraint
. The following constraint types are available:
IlvLevelRangeConstraint
|
Forces
a node into a range of certain levels |
IlvSameLevelConstraint
|
Forces
two nodes to the same level. |
IlvRelativeLevelConstraint
|
Forces
a node to a lower/higher level than another node. |
IlvGroupSpreadConstraint
|
Forces
a group of nodes on levels that are no more than a specified
spread value apart. |
IlvRelativePositionConstraint
|
Forces
a node to a lower/higher position than another node of the
same level. |
IlvSideBySideConstraint
|
Forces
two nodes of the same level to be placed side by side. |
IlvExtremityConstraint
|
Forces
a node to the first or last level, or to the first or last
position within a level. |
IlvSwimLaneConstraint
|
Forces
a group of nodes into the same rectangular swimlane area. |