Multiple links between the same pair of nodes

Sometimes a graph has multiple links between the same pair of nodes. When these links are routed straight and use the same connection point at the nodes, they overlap and cannot be distinguished. To avoid such overlaps, the specified layouts have a multilink mode that is applied only when the link style is set to STRAIGHT_LINE_STYLE. This mode has no effect when the link style is NO_RESHAPE_STYLE.
Example of specifying how multiple links are routed
In CSS
To specify the multilink mode, add to the GraphLayout section:
multiLinkMode : "NARROW_STRAIGHT_LINE_BUNDLE";
In Java
To specify the multilink mode, use the method:
void setMultiLinkMode(int mode)
The valid values for mode are given with the example of Uniform Length Edges layout:
  • IlvUniformLengthEdgesLayout.NO_BUNDLE: Multiple links between the same pair of nodes are not treated in any special way. They are not spread out and might overlap.
  • IlvUniformLengthEdgesLayout.STRAIGHT_LINE_BUNDLE: Multiple links between the same pair of nodes are routed as straight lines, but shifted relative to each other to avoid overlaps. Contrary to the narrow mode, the shift offset is not limited by the node size.
  • IlvUniformLengthEdgesLayout.NARROW_STRAIGHT_LINE_BUNDLE: Similar to the straight line bundle mode, but the shift offset is limited by the size of the two end nodes of the link bundle and therefore can appear narrower. When you have too many multiple links between the same pair of nodes, this mode avoids shifting the links so far away that they no longer appear connected to the nodes. This mode is the default.
  • IlvUniformLengthEdgesLayout.CONNECTED_ONE_BEND_BUNDLE: Multiple links between the same pair of nodes are routed with one bend to avoid overlaps. All links in the bundle start at the same connection point and end at the same connection point.
  • IlvUniformLengthEdgesLayout.FREE_ONE_BEND_BUNDLE: Multiple links between the same pair of nodes are routed with one bend to avoid overlaps. Contrary to the connected one bend bundle mode, the link connection point is not enforced; that is, the node and link are free to place the connection point. There is no guarantee that all links of the bundle start or end at a common point.
The FREE_ONE_BEND_BUNDLE mode is particularly useful when:
  • An IlvCenterLinkConnector or IlvPinLinkConnector is used that cannot change the connection point.
  • An IlvClippingLinkConnector is used while the layout should not change the attachment point.
Note
When inappropriate link classes or link connector classes are used, the layout algorithm can raise an IlvInappropriateLinkException if layout is performed on an IlvGrapher. See Layout exceptions for details and solutions to this problem.
If the multilink mode is not NO_BUNDLE, the offset between the shifted links or between the bends of the links respectively can be specified:
In CSS
Add to the GraphLayout section:
multiLinkOffset: "10";
multiLinkMaxSpread: "60";
In Java
Use the methods:
setMultiLinkOffset(float offset);
setMultiLinkMaxSpread(float maxSpread);
The multilink offset is the offset between two neighboring links (or their bends). The value of maxSpread limits this offset to avoid having too much space used when you have too many multiple links. If the multilink offset is 10 and the value of maxSpread is 60, the effective offset is 10 if you have less than six multilinks. If you have more multilinks, the effective offset is reduced. For example, if you have 15 multilinks, the effective offset will be 4 instead of 10 to ensure that the links are shifted at most 60 units apart from each other. If the multilink mode is NARROW_STRAIGHT_LINE_BUNDLE, the effective offset is further limited by the size of the bounding box of both end nodes of a link bundle.
Examples of use of mode and offset Graphical result
NO_BUNDLE
Result
of offset in NO_BUNDLE mode between a pair of links
STRAIGHT_LINE_BUNDLE when the value of maxSpread is set too high.
Result
of offset in STRAIGHT_LINE_BUNDLE with the value of max spread set
too high
NARROW_STRAIGHT_LINE_BUNDLE: the same result can be obtained with STRAIGHT_LINE_BUNDLE by reducing the value of maxSpread.
Result
of offset in NARROW_STRAIGHT_LINE_BUNDLE or in STRAIGHT_LINE_BUNDLE
with a reduced value of max spread
CONNECTED_ONE_BEND_BUNDLE
Result
of offset in CONNECTED_ONE_BEND_BUNDLE
FREE_ONE_BEND_BUNDLE when the links are initially attached to node centers.
The same result can be obtained with CONNECTED_ONE_BEND_BUNDLE in combination with the expert option connectLinksToNodeCenters. For example, see IlvBasicLinkStyleLayout.setConnectLinksToNodeCenters(boolean)
Result
of offset in FREE_ONE_BEND_BUNDLE, links initially attached to node
centers, or CONNECTED_ONE_BEND_BUNDLE with setConnectLinksToNodeCenters
set to true