Side-by-side constraints (HL)

To force nodes to be directly neighbored, use the side-by-side constraint.
In CSS
In the constraint file, specify:
SideBySideConstraint {
  group: { nodeA, nodeB, nodeC }
  priority: 100.0
}
In Java™
You can create a side-by-side constraint on a group of type IlvNodeGroup (see Node groups):
layout.addConstraint(
    new IlvSideBySideConstraint(nodeGroup, priority));
If the node group consists of just two nodes, it forces the two nodes to be placed side by side. However, it does not specify which node is at the lower node position and which node is at the higher node position. If the group consists of more than two nodes, it forces the nodes to be placed at consecutive positions such that all nodes are clustered together. A node that does not belong to the group cannot be placed between the nodes of the group.
For example, assume that the group contains the three nodes A , B , C . The constraint is satisfied if the position indexes of A , B , and C are 3, 4, 5 or 9, 7, 8. However, if node D is placed between A and B (say, D has position 4, A has position 3, and C has position 5), then the constraint is not satisfied because D does not belong to the same group.
The side-by-side constraint has an effect only if the nodes actually belong to the same level. To achieve it, you can, for instance, use a same level constraint in addition.
Side-by-side constraints have priorities that decide how to resolve constraint conflicts. The higher the priority, the more likely the constraint is satisfied.
You can use side-by-side constraints to create nested clusters. For example, in Java:
IlvNodeGroup group1 = new IlvNodeGroup();
group1.add(nodeA);
group1.add(nodeB);
group1.add(nodeC);
group1.add(nodeD);
layout.addConstraint(
    new IlvSideBySideConstraint(group1, 10.0f));
IlvNodeGroup group2 = new IlvNodeGroup();
group2.add(nodeB);
group2.add(nodeC);
layout.addConstraint(
    new IlvSideBySideConstraint(group2, 10.0f));
The first constraint specifies that nodeA , nodeB , nodeC , and nodeD must be clustered. The second constraint specifies that nodeB and nodeC are clustered inside the larger cluster. This means that no other node can be placed between the four nodes and, furthermore, nodeA or nodeD cannot be placed between nodeB and nodeC . The following figure shows four solutions that satisfy both constraints.
Four
different solutions for a set of side-by-side constraints
Sketch of solutions for side-by-side constraints