The long link mode places the links on a grid. Four parameters
control the grid offsets and five parameters control the spacing of
links in relation to other objects. Figure Spacing parameters for long link layout shows the
spacing parameters used in the long link mode.

Spacing parameters for long link layout
Grid offset parameters
The grid offset parameters control the spacing between
grid lines. Links are routed such that the center of the orthogonal
link segments is on the grid lines. The grid offsets must be set to
a value larger than the largest link width value to avoid links that
visually overlap.
Example of specifying grid offset parameters (Link Layout
algorithm)
To set the horizontal and vertical grid offset:
Use the methods setHorizontalGridOffset and setVerticalGridOffset.
layout.setHorizontalGridOffset(10); layout.setVerticalGridOffset(10);
The grid offset is the critical parameter for the long
link mode. If the grid offset is too large, there might be no grid
lines between nodes even though some free space exists between the
nodes. In this case, the link routings cannot use the free space.
However, if the grid offset is too small, the algorithm needs a long
time to traverse the grid.
Grid base parameters
Sometimes it is necessary to shift the whole grid by
a small amount because the nodes are not aligned on the grid. For
example, to have grid lines at positions 3, 13, 23, 33, and so on,
you can set the grid offset to 10 and the grid base to 3.
Example of specifying grid base parameters (Link Layout
algorithm)
To adjust the grid base:
Use the methods setHorizontalGridBase and setVerticalGridBase.
layout.setHorizontalGridBase(3); layout.setVerticalGridBase(3);
Minimum distance parameters
The minimum distance controls how closely a link can
be placed to the border of a node that needs to be bypassed. If the
node border is not aligned to the grid, the minimum distance specifies
the next grid line close to the border that can be used. For instance,
if a node covers the x-coordinates 25 - 65 on a grid with offset 10
and base 0, the next grid lines used to bypass the node would normally
be at 20 and 70. If you specify a minimum distance of 8, these grid
lines are too close to the node and then the grid lines at 10 and
80 would be used.
Example of specifying minimum distance parameters (Link
Layout algorithm)
To set the minimum distance:
Use the methods setHorizontalMinOffset and setVerticalMinOffset.
layout.setHorizontalMinOffset(8); layout.setVerticalMinOffset(8);
Minimum node corner offset parameter
The minimum corner offset is the minimum distance between
a node corner and a link that connects to the node. This parameter
is used to avoid having a link that connects exactly to the corner
or outside the border of the node (see Minimum corner offset).
Example of specifying minimum node corner offset parameter
(Link Layout algorithm)
To set the minimum corner offset:
Use the method setMinNodeCornerOffset.
layout.setMinNodeCornerOffset(4);

Minimum corner offset
Minimum final segment length
The long link layout respects the minimum value for the
length of the start and end connecting segments of the links.
Example of specifying minimum final segment length (Link
Layout algorithm)
To set the minimum length of the start segment:
Use the method setMinStartSegmentLength.
layout.setMinStartSegmentLength(10);
To set the minimum length of the end segment:
Use the method setMinEndSegmentLength.
layout.setMinEndSegmentLength(10);