Node Size Constraints

Property Value
Identifier: org.eclipse.elk.nodeSize.constraints
Meta Data Provider: core.options.CoreOptions
Value Type: java.util.EnumSet<org.eclipse.elk.core.options.SizeConstraint>
Possible Values: PORTS
Default Value: EnumSet.noneOf(SizeConstraint) (as defined in org.eclipse.elk)
Applies To: nodes
Containing Group: nodeSize


What should be taken into account when calculating a node’s size. Empty size constraints specify that a node’s size is already fixed and should not be changed.

Additional Documentation

Size constraints basically restrict the freedom a layout algorithm has in resizing a node subject to its node labels, ports, and port labels. The different values have the following meanings:

Constraint Meaning
NODE_LABELS The node can be made large enough to place all node labels without violating spacing constraints.
PORTS The node can be made large enough to place all of its ports without violating spacing constraints.
PORT_LABELS If Ports is active, not only the ports themselves are considered, but also their labels.
MINIMUM_SIZE The node must meet a given minimum size specified through the Node Size Minimum option.


We start with an example of a node with empty size constraints, which means that automatic layout is not allowed to touch the node’s size in any way. Let us assume that the size is set such that the following drawing is produced:

We will now add all size constraints, one by one, to the node to see how we gradually end up with a node size that is calculated to take everything into account.

Adding the NODE_LABELS constraint resizes the node such that it is just large enough for the node’s label. Note how the ports and their labels are completely ignored.

Adding the PORTS constraint ensures that the node is large enough to leave the necessary spacing between the ports. Only the spacing between the ports is considered, though; their labels are not taken into account yet.

Adding the PORT_LABELS constraint as well ensures that the port spacing is applied between a port’s label and the next port.

Adding the MINIMUM_SIZE constraint, finally, ensures that the computed node size won’t fall below a minimum size configured for the node. In our example, the minimum size might be wider than what the algorithm would have computed.