Search this API

## y.layout.tree Class BalloonLayouter

```java.lang.Object
y.layout.CanonicMultiStageLayouter
y.layout.tree.BalloonLayouter
```
All Implemented Interfaces:
Layouter

`public class BalloonLayouterextends CanonicMultiStageLayouter`

A tree layout algorithm that arranges the subtrees of the tree in a balloon-like fashion.

## Layout Style

`BalloonLayouter` is designed to arrange directed and undirected tree graphs. Subtrees rooted at a node are placed in a radial fashion around their root node. All direct children of one node can be placed on a common circle around their parent node (depending on the `alignment policy`). Therefore, subtrees look like balloons or stars, especially if subtrees have similar sizes. The edges of the tree are drawn as straight lines.

Sample balloon-drawing of a large tree obtained with default settings

Sample balloon-drawing featuring interleaved child placement and ray-like node labels

## Concept

The algorithm executes the following steps:

1. Select a root node according to the specified `root policy`.
2. Determine the placement of subtrees around the root using a bottom-up recursive approach (starting with leaf nodes).
• For a leaf node: calculate the convex hull of the node.
• For a non-leaf node: `arrange the children` rooted at the node. Children are sorted according to a specified `ordering policy` and a distance to their parent is chosen. This distance will be chosen such that subtrees rooted at the current node fit into the `preferred wedge angle`. The wedge angle defines how much radial space a subtree occupies around its parent; it is computed using the convex hull of subtrees.

Finally, the convex hull of the subtree rooted at the current node is updated in order to include all the convex hulls of child nodes. This is possible, because distances and wedges of the child subtrees are now known.

3. Assign the actual coordinates of nodes, again using a recursive approach (starting with the root node).

## Features

The algorithm features integrated `edge labeling` as well as `node labeling`. Edge labels and node labels are placed automatically without generating overlaps with other labels or graph elements. There are different `ways` to place node labels. Edge labeling will take the settings of `PreferredPlacementDescriptor` into account.

Defining a `preferred wedge angle` has a great influence on the layout style. Subtrees rooted at a node get a certain amount of radial space to be placed around the parent node, such that a preferred angle close to `360` degrees will generate drawings where subtrees look like balloons, while an angle close to `180` degrees could be chosen to get drawings where subtrees look like semicircles.

Since it is computationally not very complex, `BalloonLayouter` is very well suited for large tree graphs. It performs well even for huge graphs.

This layout algorithm can only handle graphs with a tree structure. To apply it to a general graph, a `TreeReductionStage` can be appended. This stage will temporarily remove some edges of the input graph until a tree is obtained. These edges will later be reinserted and routed separately.

Nested Class Summary
`static class` `BalloonLayouter.NodeInfo`
Encapsulates information bound to a node while the algorithm calculates a layout.

Field Summary
`static byte` `CENTER_ROOT`
Root node policy for choosing the center node as root node of the tree.
`static byte` `CHILD_ALIGNMENT_COMPACT`
Alignment policy for aligning child nodes such that the distances to their parent are kept short and drawings can potentially become more compact.
`static byte` `CHILD_ALIGNMENT_PLAIN`
Alignment policy to align child nodes rooted at the same parent such that the border of their convex hull has the same distance to the parent node's center.
`static byte` `CHILD_ALIGNMENT_SAME_CENTER`
Alignment policy to align child nodes rooted at the same parent such that each child has the same center-to-center distance to the parent node.
`static byte` `CHILD_ALIGNMENT_SMART`
Alignment policy to align child nodes rooted at the same parent using a mixture of the other policies and aiming to achieve symmetry and compactness at the same time.
`static byte` `CHILD_ORDERING_POLICY_COMPACT`
Child ordering policy which orders child nodes depending on their subtree size such that large subtrees are placed next to small ones in order to save space.
`static byte` `CHILD_ORDERING_POLICY_SYMMETRIC`
Child ordering policy which sorts the child nodes according to their wedge angles.
`static byte` `DIRECTED_ROOT`
Root node policy for choosing a node with indegree `0` as root node of the tree.
`protected  LayoutGraph` `graph`
The layout graph being acted upon.
`static byte` `INTERLEAVED_MODE_ALL_NODES`
A child placement mode where nodes are placed in an interleaved fashion, that is, with two different, alternating distances to the parent node.
`static byte` `INTERLEAVED_MODE_OFF`
A child placement mode where all child nodes are placed around their parent with equal distances.
`static byte` `INTERLEAVED_MODE_SELECTED_NODES`
A child placement mode where child nodes of selected nodes are placed in an interleaved fashion, that is, with two different, alternating distances to the parent node.
`static java.lang.Object` `INTERLEAVED_NODES_DPKEY`
A `DataProvider` key for marking nodes whose child nodes should be placed in an interleaved fashion This `DataProvider` allows to individually configure the interleaving feature for each node in the graph.
`static byte` `NODE_LABELING_HORIZONTAL`
Node labeling policy for horizontal label placement at all nodes.
`static byte` `NODE_LABELING_MIXED`
Node labeling policy for ray-like label placement at leaf nodes.
`static byte` `NODE_LABELING_RAYLIKE`
Node labeling policy for ray-like label placement at nodes with zero or one child node.
`static byte` `SELECTED_ROOT`
Root node policy for choosing a custom node as the root node of the tree.
`static java.lang.Object` `SELECTED_ROOT_DPKEY`
A `DataProvider` key for marking the node that will be used as root node of the tree.
`static byte` `WEIGHTED_CENTER_ROOT`
Root node policy for choosing a weighted center node as root node of the tree.

Fields inherited from interface y.layout.Layouter
`EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES`

Constructor Summary
`BalloonLayouter()`
Creates a new `BalloonLayouter` instance with default settings.

Method Summary
`protected  double` `calcAngles(Node root)`
Calculates the wedge angle that has to be reserved for the subtree rooted at the given node.
`protected  double` ```calcAngles(Node root, double scaleFactor)```
Calculates the wedge angle that has to be reserved for the subtree rooted at the given node scaling the `distance` with the given scale factor.
`protected  void` `calcChildArrangement(Node root)`
Calculates a child node arrangement for a given root node of the tree.
` boolean` `canLayoutCore(LayoutGraph graph)`
This layout algorithm accepts only graphs that are trees.
`protected  Node` `determineRoot()`
Determines the root node of `graph` according to the chosen `root node policy`.
` void` `doLayoutCore(LayoutGraph graph)`
Arranges the given graph as a tree graph in a balloon-like fashion.
` boolean` `getAllowOverlaps()`
Returns whether or not (partially) overlapping nodes are allowed.
` byte` `getChildAlignmentPolicy()`
Returns the child alignment policy for this layout algorithm.
` byte` `getChildOrderingPolicy()`
Returns the child ordering policy for sorting the child nodes around their parents.
` double` `getCompactnessFactor()`
Returns the factor defining how compact layout results will potentially be, where a smaller factor produces potentially more compact layouts.
` java.util.Comparator` `getComparator()`
Returns the `Comparator` instance that determines the order of the outgoing edges for each node of the tree.
` double` `getEdgeLabelSpacing()`
Returns the distance between edge labels belonging to the same edge as well as the distance of the edge labels to the target node of the edge.
`protected  BalloonLayouter.NodeInfo` `getInfo(Node node)`
Returns the `BalloonLayouter.NodeInfo` object associated with the given node while the layout algorithm is active.
` byte` `getInterleavedMode()`
Returns the mode for child node arrangement.
` int` `getMinimalEdgeLength()`
Returns the minimum length that this layout algorithm assigns to edges of the graph.
` int` `getMinimalNodeDistance()`
Returns the minimum distance to be kept between the nodes in the tree.
` byte` `getNodeLabelingPolicy()`
Returns the policy defining how node labels are placed by the integrated node labeling mechanism (for example, the desired label orientation).
` double` `getNodeLabelSpacing()`
Returns the distance between node labels belonging to the same node.
` int` `getPreferredChildWedge()`
Gets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around their parent node.
`protected  double` `getPreferredChildWedge(Node root)`
Returns the preferred radial amount (wedge) in degrees that child nodes may in total occupy around the given node.
` int` `getPreferredRootWedge()`
Gets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around the global root.
` byte` `getRootNodePolicy()`
Returns the root node selection policy of this layout algorithm.
` boolean` `isChainStraighteningModeEnabled()`
Returns whether or not chains are drawn straight or not.
` boolean` `isConsiderNodeLabelsEnabled()`
Returns whether or not the layout algorithm reserves space for node labels.
` boolean` `isFromSketchModeEnabled()`
Returns whether or not to consider the given coordinates of the input diagram when arranging the tree.
` boolean` `isIntegratedEdgeLabelingEnabled()`
Returns whether or not the layout algorithm automatically places edge labels.
` boolean` `isIntegratedNodeLabelingEnabled()`
Returns whether or not the layout algorithm automatically places node labels.
` void` `setAllowOverlaps(boolean allow)`
Specifies whether or not (partially) overlapping nodes are allowed.
` void` `setChainStraighteningModeEnabled(boolean chainStraighteningModeEnabled)`
Specifies whether or not chains are drawn straight or not.
` void` `setChildAlignmentPolicy(byte childAlignmentPolicy)`
Specifies the child alignment policy for this layout algorithm.
` void` `setChildOrderingPolicy(byte childOrderingPolicy)`
Sets the child ordering policy for sorting the child nodes around their parents.
` void` `setCompactnessFactor(double factor)`
Specifies the factor defining how compact layout results will potentially be, where a smaller factor produces potentially more compact layouts.
` void` `setComparator(java.util.Comparator comparator)`
Sets the `Comparator` instance that determines the order of the outgoing edges for each node of the tree.
` void` `setComponentLayouterEnabled(boolean enabled)`
Specifies whether or not the `LayoutStage` used for arranging the components of the graph is activated.
` void` `setConsiderNodeLabelsEnabled(boolean considerNodeLabelsEnabled)`
Specifies whether or not the layout algorithm reserves space for node labels.
` void` `setEdgeLabelSpacing(double edgeLabelSpacing)`
Specifies the distance between edge labels belonging to the same edge as well as the distance of the edge labels to the target node of the edge.
` void` `setFromSketchModeEnabled(boolean fromSketchModeEnabled)`
Specifies whether or not to consider the given coordinates of the input diagram when arranging the tree.
` void` `setGroupNodeHidingEnabled(boolean groupNodeHidingEnabled)`
Specifies whether or not the `LayoutStage` used for hiding group nodes is activated.
` void` `setIntegratedEdgeLabelingEnabled(boolean integratedEdgeLabelingEnabled)`
Specifies whether or not the layout algorithm automatically places edge labels.
` void` `setIntegratedNodeLabelingEnabled(boolean integratedNodeLabelingEnabled)`
Specifies whether or not the layout algorithm automatically places node labels.
` void` `setInterleavedMode(byte interleavedMode)`
Specifies the mode for child node arrangement.
` void` `setMinimalEdgeLength(int length)`
Sets the minimum length that this layout algorithm assigns to edges of the graph.
` void` `setMinimalNodeDistance(int minimalNodeDistance)`
Sets the minimum distance to be kept between the nodes in the tree.
` void` `setNodeLabelingPolicy(byte nodeLabelingPolicy)`
Specifies the policy defining how node labels are placed by the integrated node labeling mechanism (for example, the desired label orientation).
` void` `setNodeLabelSpacing(double nodeLabelSpacing)`
Specifies the distance between node labels belonging to the same node.
` void` `setOrientationLayouterEnabled(boolean enabled)`
Specifies whether or not the `LayoutStage` that modifies the orientation of the layout is activated.
` void` `setParallelEdgeLayouterEnabled(boolean enabled)`
Specifies whether or not the `LayoutStage` used for routing parallel edges is activated.
` void` `setPreferredChildWedge(int wedgeAngle)`
Sets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around their parent node.
` void` `setPreferredRootWedge(int wedgeAngle)`
Sets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around the global root.
` void` `setRootNodePolicy(byte policy)`
Specifies the root node selection policy of this layout algorithm.
` void` `setSelfLoopLayouterEnabled(boolean enabled)`
Specifies whether or not the `LayoutStage` used for routing self-loops is activated.
`protected  void` `sortChildNodes(Node root)`
Sorts the child nodes (successors) of the given node.

Methods inherited from class y.layout.CanonicMultiStageLayouter
`appendStage, calcLayout, calcLayout, canLayout, checkGroupNodeSize, checkNodeSize, doLayout, doLayout, enableOnlyCore, getComponentLayouter, getGroupNodeHider, getLabelLayouter, getLayoutOrientation, getOrientationLayouter, getParallelEdgeLayouter, getSelfLoopLayouter, getSubgraphLayouter, isComponentLayouterEnabled, isGroupNodeHidingEnabled, isLabelLayouterEnabled, isOrientationLayouterEnabled, isParallelEdgeLayouterEnabled, isSelfLoopLayouterEnabled, isSubgraphLayouterEnabled, prependStage, removeStage, setComponentLayouter, setGroupNodeHider, setLabelLayouter, setLabelLayouterEnabled, setLayoutOrientation, setOrientationLayouter, setParallelEdgeLayouter, setSelfLoopLayouter, setSubgraphLayouter, setSubgraphLayouterEnabled`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### INTERLEAVED_NODES_DPKEY

`public static final java.lang.Object INTERLEAVED_NODES_DPKEY`
A `DataProvider` key for marking nodes whose child nodes should be placed in an interleaved fashion

This `DataProvider` allows to individually configure the interleaving feature for each node in the graph.

The custom node selection induced by this `DataProvider` is only considered if the interleaved mode is set to `INTERLEAVED_MODE_SELECTED_NODES`.
`setInterleavedMode(byte)`

### INTERLEAVED_MODE_OFF

`public static final byte INTERLEAVED_MODE_OFF`
A child placement mode where all child nodes are placed around their parent with equal distances.

The point to which the distance to the parent is measured may vary depending on the selected `alignment policy` (e.g. distance to node center or distance to convex hull border).
`setInterleavedMode(byte)`, Constant Field Values
Sample Graph:
 Child nodes have equal distances to their parent

### INTERLEAVED_MODE_ALL_NODES

`public static final byte INTERLEAVED_MODE_ALL_NODES`
A child placement mode where nodes are placed in an interleaved fashion, that is, with two different, alternating distances to the parent node.

If there is enough space within the desired child wedge of some node to place all children without using different distances, interleaving will be omitted.
`setInterleavedMode(byte)`, Constant Field Values
Sample Graph:
 Child nodes are placed in an interleaved fashion

### INTERLEAVED_MODE_SELECTED_NODES

`public static final byte INTERLEAVED_MODE_SELECTED_NODES`
A child placement mode where child nodes of selected nodes are placed in an interleaved fashion, that is, with two different, alternating distances to the parent node.

All other nodes are placed without interleaving. The node selection can be specified by registering an appropriate `DataProvider` for key `INTERLEAVED_NODES_DPKEY`.

If there is enough space within the desired child wedge of a selected node to place all children without using different distances, interleaving will be omitted.
`setInterleavedMode(byte)`, Constant Field Values
Sample Graph:
 The selected node has interleaved child nodes

### NODE_LABELING_RAYLIKE

`public static final byte NODE_LABELING_RAYLIKE`
Node labeling policy for ray-like label placement at nodes with zero or one child node.

Labels belonging to leaf nodes and nodes with exactly one successor (thus forming a sort of chain) will not be oriented horizontal but ray-like; they get the same orientation as their nodes' incoming edge. The labels of the other nodes will be oriented horizontally and placed at the center of the corresponding node.

`setNodeLabelingPolicy(byte)`, Constant Field Values
Sample Graph:
 Ray-like labels for leaf nodes and nodes with outdegree = `1`

### NODE_LABELING_MIXED

`public static final byte NODE_LABELING_MIXED`
Node labeling policy for ray-like label placement at leaf nodes.

Labels corresponding to leaf nodes get the same orientation as their nodes' incoming edge and are placed outside the node (without overlaps). The labels of the other nodes will be oriented horizontally and placed at the center of the corresponding node.

`setNodeLabelingPolicy(byte)`, Constant Field Values
Sample Graph:
 Ray-like labels for leaf nodes

### NODE_LABELING_HORIZONTAL

`public static final byte NODE_LABELING_HORIZONTAL`
Node labeling policy for horizontal label placement at all nodes.

The node labels are placed at the center of the corresponding node.

`setNodeLabelingPolicy(byte)`, Constant Field Values
Sample Graph:
 Horizontal labels

### CHILD_ALIGNMENT_PLAIN

`public static final byte CHILD_ALIGNMENT_PLAIN`
Alignment policy to align child nodes rooted at the same parent such that the border of their convex hull has the same distance to the parent node's center.

Convex hulls of nodes are always defined as circles.
`setChildAlignmentPolicy(byte)`, Constant Field Values
Sample Graph:
 All child nodes with equal distance between their convex hull border and the parent

### CHILD_ALIGNMENT_SAME_CENTER

`public static final byte CHILD_ALIGNMENT_SAME_CENTER`
Alignment policy to align child nodes rooted at the same parent such that each child has the same center-to-center distance to the parent node.

All nodes will be placed on a common radius around their parent, respective to their center coordinates.

Two different radii will be realized, if the `interleaved mode` is active.
`setChildAlignmentPolicy(byte)`, Constant Field Values
Sample Graph:
 All child nodes with equal center-to-center distance to the parent

### CHILD_ALIGNMENT_COMPACT

`public static final byte CHILD_ALIGNMENT_COMPACT`
Alignment policy for aligning child nodes such that the distances to their parent are kept short and drawings can potentially become more compact.

This policy realizes the exact same child alignment as `CHILD_ALIGNMENT_PLAIN` if there are no edge labels associated with edges going to child nodes or if `integrated edge labeling` is disabled.

If edge labels need to be considered, edge labels will be added to the convex hull of the child node to which the edge connects. This means that child nodes connected with a labeled edge will be aligned at the border where the edge label begins. In consequence, edge labels will be aligned with neighboring edge labels as well as neighboring child nodes if a child node has no edge label at its incoming edge.

This alignment strategy is especially effective if large edge labels need to be considered while drawings should still be compact and distances from parent to child nodes short.

Since compactness is prioritized in conjunction with large edge labels, drawings may lack symmetry regarding node distances.
`setChildAlignmentPolicy(byte)`, Constant Field Values
Sample Graph:
 Compact alignment of child nodes

### CHILD_ALIGNMENT_SMART

`public static final byte CHILD_ALIGNMENT_SMART`
Alignment policy to align child nodes rooted at the same parent using a mixture of the other policies and aiming to achieve symmetry and compactness at the same time.

Similar to `CHILD_ALIGNMENT_SAME_CENTER`, this policy aims to achieve alignments featuring equal distances between parent and child node centers. However, a much larger distance for all child nodes caused by single large subtrees is avoided by this policy. In such cases, the smaller subtrees may be placed on a common radius and the large subtrees are placed with different distances.

Has no effect if the interleaved mode is active `getInterleavedMode()`. In that case, a `plain child alignment` will be applied instead.
`setChildAlignmentPolicy(byte)`, Constant Field Values

### CHILD_ORDERING_POLICY_COMPACT

`public static final byte CHILD_ORDERING_POLICY_COMPACT`
Child ordering policy which orders child nodes depending on their subtree size such that large subtrees are placed next to small ones in order to save space.

The actual area of a subtree is used as the subtree size. The smallest subtree is placed next to the largest subtree, followed by the second smallest subtree and so on. This way, drawings can become more compact, because the adjacent placement of large subtrees is avoided (which would require edges to become longer for subtrees to fit next to each other).

`setChildOrderingPolicy(byte)`, Constant Field Values
Sample Graph:
 Node ordering according to (alternating) subtree sizes

### CHILD_ORDERING_POLICY_SYMMETRIC

`public static final byte CHILD_ORDERING_POLICY_SYMMETRIC`
Child ordering policy which sorts the child nodes according to their wedge angles.

The node with the greatest angle gets median position in the sorting order. The smaller the wedges, the farther away a node will be placed from the median position. Using this policy, the produced results are often more symmetric.

`setChildOrderingPolicy(byte)`, Constant Field Values
Sample Graph:
 Node ordering according to wedge angles

### DIRECTED_ROOT

`public static final byte DIRECTED_ROOT`
Root node policy for choosing a node with indegree `0` as root node of the tree.

The selection of the root node will happen according to `Trees.getRoot(Graph)`.

`setRootNodePolicy(byte)`, `Trees.getRoot(Graph)`, Constant Field Values
Sample Graph:
 Selected root node is highlighted

### CENTER_ROOT

`public static final byte CENTER_ROOT`
Root node policy for choosing the center node as root node of the tree.

A `center node` induces a minimum depth tree when being used as the root of that tree.

`setRootNodePolicy(byte)`, `Trees.getCenterRoot(Graph)`, Constant Field Values
Sample Graph:
 Selected root node is highlighted

### WEIGHTED_CENTER_ROOT

`public static final byte WEIGHTED_CENTER_ROOT`
Root node policy for choosing a weighted center node as root node of the tree.

A `weighted center node` is a node which is part of the greatest number of all undirected paths in a graph.

`setRootNodePolicy(byte)`, Constant Field Values
Sample Graph:
 Selected root node is highlighted

### SELECTED_ROOT

`public static final byte SELECTED_ROOT`
Root node policy for choosing a custom node as the root node of the tree.

The root node is specified using a `DataProvider` registered with the graph with key `SELECTED_ROOT_DPKEY`.

`setRootNodePolicy(byte)`, Constant Field Values
Sample Graph:
 Selected root node is highlighted

### SELECTED_ROOT_DPKEY

`public static final java.lang.Object SELECTED_ROOT_DPKEY`
A `DataProvider` key for marking the node that will be used as root node of the tree.

The custom root node selection induced by this `DataProvider` is only considered if the `root node policy` is set to `SELECTED_ROOT`.
`setRootNodePolicy(byte)`

### graph

`protected LayoutGraph graph`
The layout graph being acted upon.

Constructor Detail

### BalloonLayouter

`public BalloonLayouter()`
Creates a new `BalloonLayouter` instance with default settings.

Method Detail

### getComparator

`public java.util.Comparator getComparator()`
Returns the `Comparator` instance that determines the order of the outgoing edges for each node of the tree.

If no `Comparator` is specified (i.e. the `Comparator` is `null`), the outgoing edges will be sorted according to the current `child ordering policy`.

If `From Sketch` mode is enabled, the specified comparator does not have any effect.
Returns:
a `Comparator` instance to sort outgoing edges or `null` if edges are sorted according to the `child ordering policy`
`setComparator(Comparator)`, `setChildOrderingPolicy(byte)`, `setFromSketchModeEnabled(boolean)`

### setComparator

`public void setComparator(java.util.Comparator comparator)`
Sets the `Comparator` instance that determines the order of the outgoing edges for each node of the tree.

If no `Comparator` is specified (i.e. the `Comparator` is `null`), the outgoing edges will be sorted according to the current `child ordering policy`.

If `From Sketch` mode is enabled, the specified comparator does not have any effect.
Default Value:
The default value is null. The algorithm uses a built-in sorting logic.
Parameters:
`comparator` - a `Comparator` instance to sort outgoing edges or `null` if edges should be sorted according to the `child ordering policy`
`setChildOrderingPolicy(byte)`, `setFromSketchModeEnabled(boolean)`

### getChildOrderingPolicy

`public byte getChildOrderingPolicy()`
Returns the child ordering policy for sorting the child nodes around their parents.

The sorting policy can affect the compactness of drawings. Advantageous orderings allow adjacent subtrees to be close together and can thus make the whole layout more compact.

This policy is ignored if `From Sketch mode` is enabled.
Returns:
one of the predefined child ordering policies
`setChildOrderingPolicy(byte)`, `setFromSketchModeEnabled(boolean)`, `setComparator(Comparator)`

### setChildOrderingPolicy

`public void setChildOrderingPolicy(byte childOrderingPolicy)`
Sets the child ordering policy for sorting the child nodes around their parents.

The sorting policy can affect the compactness of drawings. Advantageous orderings allow adjacent subtrees to be close together and can thus make the whole layout more compact.

This policy is ignored if `From Sketch mode` is enabled.
Default Value:
The default value is `CHILD_ORDERING_POLICY_COMPACT`
Parameters:
`childOrderingPolicy` - one of the predefined child ordering policies
Throws:
`java.lang.IllegalArgumentException` - if an unknown ordering policy is given
`setFromSketchModeEnabled(boolean)`, `setComparator(Comparator)`

### getMinimalNodeDistance

`public int getMinimalNodeDistance()`
Returns the minimum distance to be kept between the nodes in the tree.

The distance needs to be a non-negative integer value.

This minimum distance is not always considered if overlaps are `allowed`.
Returns:
the non-negative minimum node distance
`setMinimalNodeDistance(int)`, `setAllowOverlaps(boolean)`

### setMinimalNodeDistance

`public void setMinimalNodeDistance(int minimalNodeDistance)`
Sets the minimum distance to be kept between the nodes in the tree.

The distance needs to be a non-negative integer value.

This minimum distance is not always considered if overlaps are `allowed`.
Default Value:
The default value is 10.
Parameters:
`minimalNodeDistance` - the non-negative minimum node distance
Throws:
`java.lang.IllegalArgumentException` - if the given minimum distance is negative
`setAllowOverlaps(boolean)`
Sample Graphs:
 Minimum distance `0` (default) Minimum distance `60`

### isFromSketchModeEnabled

`public boolean isFromSketchModeEnabled()`
Returns whether or not to consider the given coordinates of the input diagram when arranging the tree.

Enabling this feature, the original circular order of child nodes around their parent nodes will be maintained according to the initial coordinates when determining the order of the child nodes.

Returns:
`true` if the initial coordinates of the nodes are considered, `false` otherwise
`setFromSketchModeEnabled(boolean)`

### setFromSketchModeEnabled

`public void setFromSketchModeEnabled(boolean fromSketchModeEnabled)`
Specifies whether or not to consider the given coordinates of the input diagram when arranging the tree.

Enabling this feature, the original circular order of child nodes around their parent nodes will be maintained according to the initial coordinates when determining the order of the child nodes.

Default Value:
The default value is false. The coordinates of the input are not considered.
Parameters:
`fromSketchModeEnabled` - `true` if the initial coordinates of the nodes should be considered, `false` otherwise
Sample Graphs:
 Example of initial graph with child ordering from smallest to largest node `true` - the initial ordering was maintained `false` - the initial ordering was not maintained

### setRootNodePolicy

`public void setRootNodePolicy(byte policy)`
Specifies the root node selection policy of this layout algorithm.

The policy determines which node is chosen as (virtual) tree root during the layout process.

Default Value:
The default value is `DIRECTED_ROOT`
Parameters:
`policy` - one of the predefined root node policies
Throws:
`java.lang.IllegalArgumentException` - if an unknown root node policy is given

### getRootNodePolicy

`public byte getRootNodePolicy()`
Returns the root node selection policy of this layout algorithm.

The policy determines which node is chosen as (virtual) tree root during the layout process.

Returns:
one of the predefined root node policies
`setRootNodePolicy(byte)`

### setPreferredChildWedge

`public void setPreferredChildWedge(int wedgeAngle)`
Sets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around their parent node.

The wedge angle controls the degree to which the child nodes may radiate from the center of layout. A value close to `360` means that the child nodes may radiate in (almost) any direction from their parent node, edge lengths can in consequence stay rather small. On the other hand, a small value means that children are restricted to a small angle; thus, edge lengths (and drawings) may become large.

The minimum allowed wedge angle is `1` and the maximum allowed value is `359`.

To get drawings where each subtree looks balloon-like, an angle close to `360` is needed.

The angle of the designated root node of the tree is not affected by this setting. The preferred angle of the root can be specified using `setPreferredRootWedge(int)`.
Default Value:
The default value is 340.
Parameters:
`wedgeAngle` - the preferred wedge angle in degrees from the interval `[1,359]`
Throws:
`java.lang.IllegalArgumentException` - if the given angle is smaller than `1` or larger than `359`
`setPreferredRootWedge(int)`
Sample Graphs:
 Child wedge angle `359` (same for root node) Child wedge angle `180` (`359` for the root node) Child wedge angle `90` (`359` for the root node)

### setPreferredRootWedge

`public void setPreferredRootWedge(int wedgeAngle)`
Sets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around the global root.

This property allows to separately control the wedge angle for the designated root node of the tree, while `setPreferredChildWedge(int)` controls the angles of all child nodes. The root node will be determined depending on the `root node policy`.

The minimum allowed root wedge angle is `1` and the maximum allowed value is `360`.

Default Value:
The default value is 360.
Parameters:
`wedgeAngle` - the preferred wedge angle in degrees from the interval `[1,360]`
Throws:
`java.lang.IllegalArgumentException` - if the given angle is smaller than `1` or larger than `360`
`setPreferredChildWedge(int)`
Sample Graphs:
 Root wedge angle `180` Root wedge angle `360`

### getPreferredRootWedge

`public int getPreferredRootWedge()`
Gets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around the global root.

This property allows to separately control the wedge angle for the designated root node of the tree, while `setPreferredChildWedge(int)` controls the angles of all child nodes. The root node will be determined depending on the `root node policy`.

The minimum allowed root wedge angle is `1` and the maximum allowed value is `360`.

Returns:
the preferred wedge angle in degrees from the interval `[1,360]`
`setPreferredRootWedge(int)`, `setPreferredChildWedge(int)`

### getPreferredChildWedge

`public int getPreferredChildWedge()`
Gets the preferred radial amount (wedge) in degrees that child nodes may in total occupy around their parent node.

The wedge angle controls the degree to which the child nodes may radiate from the center of layout. A value close to `360` means that the child nodes may radiate in (almost) any direction from their parent node, edge lengths can in consequence stay rather small. On the other hand, a small value means that children are restricted to a small angle; thus, edge lengths (and drawings) may become large.

The minimum allowed wedge angle is `1` and the maximum allowed value is `359`.

Returns:
the preferred wedge angle in degrees from the interval `[1,359]`
`setPreferredChildWedge(int)`, `setPreferredRootWedge(int)`

### setAllowOverlaps

`public void setAllowOverlaps(boolean allow)`
Specifies whether or not (partially) overlapping nodes are allowed.

If overlaps are allowed, the resulting layouts can become significantly more compact. Overlaps will mostly occur at the borders of nodes. Nodes will not be totally covered by other nodes.

For smaller graphs or graphs where most nodes have a low outdegree count, overlaps will often not occur, even if this property is enabled. This allows really compact drawings of such graphs.

The computation of the convex hull of a node depends on this setting: the outer circle with respect to the rectangle defined by height and width of a node is taken if overlaps ar not allowed. Otherwise, the inner circle is used for the convex hull.
Default Value:
The default value is false. Nodes are not allowed to overlap.
Parameters:
`allow` - `true` if node overlaps should be allowed, `false` otherwise
Sample Graphs:
 `false` `true`

### getAllowOverlaps

`public boolean getAllowOverlaps()`
Returns whether or not (partially) overlapping nodes are allowed.

If overlaps are allowed, the resulting layouts can become significantly more compact. Overlaps will mostly occur at the borders of nodes. Nodes will not be totally covered by other nodes.

For smaller graphs or graphs where most nodes have a low outdegree count, overlaps will often not occur, even if this property is enabled. This allows really compact drawings of such graphs.

The computation of the convex hull of a node depends on this setting: the outer circle with respect to the rectangle defined by height and width of a node is taken if overlaps ar not allowed. Otherwise, the inner circle is used for the convex hull.
Returns:
`true` if node overlaps are allowed, `false` otherwise
`setAllowOverlaps(boolean)`

### setCompactnessFactor

`public void setCompactnessFactor(double factor)`
Specifies the factor defining how compact layout results will potentially be, where a smaller factor produces potentially more compact layouts.

The algorithm tries to optimize the child node arrangement around each tree node such that each subtree is as close to its root as possible, while still fitting into the ```preferred wedge angle``` and not overlapping with adjacent subtrees.

High compactness factor values induce the optimization procedure to be less strict and accept less optimal results, while low factor values mean that the optimization will only stop when being nearly optimal. Thus, lower values lead to a potentially higher runtime.

The minimum factor value is `0.05` and the maximum is `1.0`.

Default Value:
The default value is 0.5. A factor offering good balance between compactness and runtime.
Parameters:
`factor` - the compactness factor from the interval `[0.05, 1.0]`
Throws:
`java.lang.IllegalArgumentException` - if the factor is smaller than `0.05` or greater than `1.0`

### getCompactnessFactor

`public double getCompactnessFactor()`
Returns the factor defining how compact layout results will potentially be, where a smaller factor produces potentially more compact layouts.

The algorithm tries to optimize the child node arrangement around each tree node such that each subtree is as close to its root as possible, while still fitting into the ```preferred wedge angle``` and not overlapping with adjacent subtrees.

High compactness factor values induce the optimization procedure to be less strict and accept less optimal results, while low factor values mean that the optimization will only stop when being nearly optimal. Thus, lower values lead to a potentially higher runtime.

The minimum factor value is `0.05` and the maximum is `1.0`.

Returns:
the compactness factor from the interval [0.05, 1.0]
`setCompactnessFactor(double)`

### setMinimalEdgeLength

`public void setMinimalEdgeLength(int length)`
Sets the minimum length that this layout algorithm assigns to edges of the graph.

A lower minimum edge length allows generally more compact layouts. It has the highest effect if most nodes of the graph have a low degree, as the minimum can potentially be met for such graphs.

The minimum length must be non-negative.

Really small minimum edge length values (i.e. smaller than 5) are not recommended, because edges may be barely visible in the result drawing.
Default Value:
The default value is 40.
Parameters:
`length` - the non-negative minimum edge length
Throws:
`java.lang.IllegalArgumentException` - if the given length is negative
Sample Graphs:
 `20` `60`

### getMinimalEdgeLength

`public int getMinimalEdgeLength()`
Returns the minimum length that this layout algorithm assigns to edges of the graph.

A lower minimum edge length allows generally more compact layouts. It has the highest effect if most nodes of the graph have a low degree, as the minimum can potentially be met for such graphs.

The minimum length must be non-negative.

Returns:
the non-negative minimum edge length
`setMinimalEdgeLength(int)`

### isConsiderNodeLabelsEnabled

`public boolean isConsiderNodeLabelsEnabled()`
Returns whether or not the layout algorithm reserves space for node labels.

The size of nodes will temporarily be adjusted such that the label is included. Therefore, result drawings may get significantly larger if this feature is enabled.

This option only works correctly if the `layout orientation` is set to `LayoutOrientation.TOP_TO_BOTTOM` (which is the default). Changing the layout orientation for an undirected layout algorithm like the `BalloonLayouter` doesn't make sense.
Returns:
`true` if node labels are considered, `false` otherwise
`setConsiderNodeLabelsEnabled(boolean)`

### setConsiderNodeLabelsEnabled

`public void setConsiderNodeLabelsEnabled(boolean considerNodeLabelsEnabled)`
Specifies whether or not the layout algorithm reserves space for node labels.

The size of nodes will temporarily be adjusted such that the label is included. Therefore, result drawings may get significantly larger if this feature is enabled.

This option only works correctly if the `layout orientation` is set to `LayoutOrientation.TOP_TO_BOTTOM` (which is the default). Changing the layout orientation for an undirected layout algorithm like the `BalloonLayouter` doesn't make sense.

This has an effect only if the `integrated node labeling` mechanism is disabled.
Default Value:
The default value is false. Node labels are not considered.
Parameters:
`considerNodeLabelsEnabled` - `true` if node labels should be considered, `false` otherwise
Sample Graphs:
 `false` `true`

### getInterleavedMode

`public byte getInterleavedMode()`
Returns the mode for child node arrangement.

Child nodes are either placed interleaved or on a single layer around their parent node. Interleaved placement means that child nodes are placed around their common parent in two different layers in an alternating fashion. For example, the first child is on the inner layer, the second child on the outer layer, the third one again on the inner layer, etc.

Independent of this mode, the alignment of child nodes on the same layer is still defined by the `alignment policy`. However, `CHILD_ALIGNMENT_SMART` is only supported for non-interleaved arrangement.

Interleaved placement leads to the best results if all subtrees rooted at a node have similar total sizes or if there are two groups of different sizes among the subtrees. In these cases, interleaved placement makes drawings much more compact and still shows symmetries.

Activating interleaved child arrangement for all or for selected nodes will cause the `ordering policy` to have no more effect for those nodes.
Returns:
the mode for interleaved child node arrangement
`setInterleavedMode(byte)`, `setChildAlignmentPolicy(byte)`

### setInterleavedMode

`public void setInterleavedMode(byte interleavedMode)`
Specifies the mode for child node arrangement.

Child nodes are either placed interleaved or on a single layer around their parent node. Interleaved placement means that child nodes are placed around their common parent in two different layers in an alternating fashion. For example, the first child is on the inner layer, the second child on the outer layer, the third one again on the inner layer, etc.

Independent of this mode, the alignment of child nodes on the same layer is still defined by the `alignment policy`. However, `CHILD_ALIGNMENT_SMART` is only supported for non-interleaved arrangement.

Interleaved placement leads to the best results if all subtrees rooted at a node have similar total sizes or if there are two groups of different sizes among the subtrees. In these cases, interleaved placement makes drawings much more compact and still shows symmetries.

Activating interleaved child arrangement for all or for selected nodes will cause the `ordering policy` to have no more effect for those nodes.
Default Value:
The default value is `INTERLEAVED_MODE_OFF`. Interleaved placement is disabled.
Parameters:
`interleavedMode` - the mode for interleaved child node arrangement
Throws:
`java.lang.IllegalArgumentException` - if an unknown mode for interleaved arrangement is given
`setChildAlignmentPolicy(byte)`

### getChildAlignmentPolicy

`public byte getChildAlignmentPolicy()`
Returns the child alignment policy for this layout algorithm.

This policy influences the distance of child nodes to their parent nodes and the alignment of children with the same parent.

The alignment policy can have a high influence on the result if node sizes and/or subtree sizes are differing a lot. It also has a high influence if the graph contains labels - especially large edge labels - and if ```integrated labeling``` is enabled.
Returns:
one of the predefined child alignment policies
`setChildAlignmentPolicy(byte)`

### setChildAlignmentPolicy

`public void setChildAlignmentPolicy(byte childAlignmentPolicy)`
Specifies the child alignment policy for this layout algorithm.

This policy influences the distance of child nodes to their parent nodes and the alignment of children with the same parent.

The alignment policy can have a high influence on the result if node sizes and/or subtree sizes are differing a lot. It also has a high influence if the graph contains labels - especially large edge labels - and if ```integrated labeling``` is enabled.
Default Value:
The default value is `CHILD_ALIGNMENT_COMPACT`
Parameters:
`childAlignmentPolicy` - one of the predefined child alignment policies
Throws:
`java.lang.IllegalArgumentException` - if an unknown policy is given

### isIntegratedNodeLabelingEnabled

`public boolean isIntegratedNodeLabelingEnabled()`
Returns whether or not the layout algorithm automatically places node labels.

If enabled, this layout algorithm will calculate the positions for the node labels assuring that no overlaps occur.

Different labeling strategies may be selected using `setNodeLabelingPolicy(byte)`.

Optimal label placement with integrated labeling can be achieved using `FreeNodeLabelModel` as the `NodeLabelModel` for the nodes.

If integrated labeling is enabled, then the simple `consideration mechanism` has no more effect.
Returns:
`true` if integrated node labeling is enabled, `false` otherwise.
`setIntegratedNodeLabelingEnabled(boolean)`

### setIntegratedNodeLabelingEnabled

`public void setIntegratedNodeLabelingEnabled(boolean integratedNodeLabelingEnabled)`
Specifies whether or not the layout algorithm automatically places node labels.

If enabled, this layout algorithm will calculate the positions for the node labels assuring that no overlaps occur.

Different labeling strategies may be selected using `setNodeLabelingPolicy(byte)`.

Optimal label placement with integrated labeling can be achieved using `FreeNodeLabelModel` as the `NodeLabelModel` for the nodes.

If integrated labeling is enabled, then the simple `consideration mechanism` has no more effect.
Default Value:
The default value is false. Node labels are not placed by this algorithm.
Parameters:
`integratedNodeLabelingEnabled` - `true` if integrated node labeling should be enabled, `false` otherwise.
`setNodeLabelingPolicy(byte)`
Sample Graphs:
 `false` - Note that assumed label positions before the layout run were not changed `true` - Labels were automatically placed

### isIntegratedEdgeLabelingEnabled

`public boolean isIntegratedEdgeLabelingEnabled()`
Returns whether or not the layout algorithm automatically places edge labels.

If enabled, this layout algorithm will calculate the positions for the edge labels assuring that no overlaps occur.

Optimal label placement with integrated labeling can be achieved using `FreeEdgeLabelModel` as the `EdgeLabelModel` for the edges.
Returns:
`true` if integrated edge labeling is enabled, `false` otherwise.
`setIntegratedEdgeLabelingEnabled(boolean)`

### setIntegratedEdgeLabelingEnabled

`public void setIntegratedEdgeLabelingEnabled(boolean integratedEdgeLabelingEnabled)`
Specifies whether or not the layout algorithm automatically places edge labels.

If enabled, this layout algorithm will calculate the positions for the edge labels assuring that no overlaps occur.

Optimal label placement with integrated labeling can be achieved using `FreeEdgeLabelModel` as the `EdgeLabelModel` for the edges.

When enabling integrated edge labeling, it is recommended to also enable `chain straightening`, because edge labels (especially large ones) may lead to significantly non-straight node chains.
Default Value:
The default value is false. Edge labels are not placed by this algorithm.
Parameters:
`integratedEdgeLabelingEnabled` - `true` if integrated edge labeling should be enabled, `false` otherwise.
Sample Graphs:
 `false` `true`

### getNodeLabelingPolicy

`public byte getNodeLabelingPolicy()`
Returns the policy defining how node labels are placed by the integrated node labeling mechanism (for example, the desired label orientation).

The policy only has an effect if ```integrated node labeling``` is enabled.
Returns:
one of the predefined node labeling policies
`setNodeLabelingPolicy(byte)`, `setIntegratedNodeLabelingEnabled(boolean)`

### setNodeLabelingPolicy

`public void setNodeLabelingPolicy(byte nodeLabelingPolicy)`
Specifies the policy defining how node labels are placed by the integrated node labeling mechanism (for example, the desired label orientation).

The policy only has an effect if ```integrated node labeling``` is enabled.
Default Value:
The default value is `NODE_LABELING_RAYLIKE`
Parameters:
`nodeLabelingPolicy` - one of the predefined node labeling policies
Throws:
`java.lang.IllegalArgumentException` - if an unknown labeling policy is given
`setIntegratedNodeLabelingEnabled(boolean)`

### setNodeLabelSpacing

`public void setNodeLabelSpacing(double nodeLabelSpacing)`
Specifies the distance between node labels belonging to the same node.

It also defines the distance between labels and the node they belong to in case of label placement outside of the node (e.g. for `ray-like label placement`).

The spacing must have a non-negative value.

With a spacing of `0`, node labels will be maximally close to each other and to their node.

The spacing value has an effect only if `integrated node labeling` is enabled.
Default Value:
The default value is 4.0.
Parameters:
`nodeLabelSpacing` - the non-negative node label spacing
Throws:
`java.lang.IllegalArgumentException` - if the given spacing value is negative
`isIntegratedNodeLabelingEnabled()`
Sample Graphs:
 Default node label spacing of `4.0` Node label spacing set to `16.0`

### getNodeLabelSpacing

`public double getNodeLabelSpacing()`
Returns the distance between node labels belonging to the same node.

It also defines the distance between labels and the node they belong to in case of label placement outside of the node (e.g. for `ray-like label placement`).

The spacing must have a non-negative value.

The spacing value has an effect only if `integrated node labeling` is enabled.
Returns:
the non-negative node label spacing
`setIntegratedNodeLabelingEnabled(boolean)`, `setNodeLabelSpacing(double)`

### setEdgeLabelSpacing

`public void setEdgeLabelSpacing(double edgeLabelSpacing)`
Specifies the distance between edge labels belonging to the same edge as well as the distance of the edge labels to the target node of the edge.

The spacing must have a non-negative value.

With a spacing of `0`, labels will touch each other and the target node.

The spacing value has an effect only if `integrated edge labeling` is enabled.
Default Value:
The default value is 4.0. Labels are close together and close to targets.
Parameters:
`edgeLabelSpacing` - the non-negative edge label spacing
Throws:
`java.lang.IllegalArgumentException` - if the given label spacing value is negative
`setIntegratedEdgeLabelingEnabled(boolean)`
Sample Graphs:
 Default edge label spacing of `4.0` Edge label spacing set to `16.0`

### getEdgeLabelSpacing

`public double getEdgeLabelSpacing()`
Returns the distance between edge labels belonging to the same edge as well as the distance of the edge labels to the target node of the edge.

The spacing must have a non-negative value.

The spacing value has an effect only if `integrated edge labeling` is enabled.
Returns:
the non-negative edge label spacing
`setIntegratedEdgeLabelingEnabled(boolean)`, `setEdgeLabelSpacing(double)`

### isChainStraighteningModeEnabled

`public boolean isChainStraighteningModeEnabled()`
Returns whether or not chains are drawn straight or not.

A chain is defined as a tree node with exactly one child node. If this feature is enabled, then the incoming edge and outgoing edge of the chain will have the same orientation, i.e., the whole chain looks straight.

Straightening all chains can lead to smoother, more symmetric results.

Returns:
`true` if chains are drawn straight, `false` otherwise.
`setChainStraighteningModeEnabled(boolean)`

### setChainStraighteningModeEnabled

`public void setChainStraighteningModeEnabled(boolean chainStraighteningModeEnabled)`
Specifies whether or not chains are drawn straight or not.

A chain is defined as a tree node with exactly one child node. If this feature is enabled, then the incoming edge and outgoing edge of the chain will have the same orientation, i.e., the whole chain looks straight.

Straightening all chains can lead to smoother, more symmetric results.

This feature improves result quality especially if a graph has many (large) labels associated to nodes and edges, because in that case non-straight chains are more likely.
Default Value:
The default value is false. There is no guarantee that chains are drawn straight.
Parameters:
`chainStraighteningModeEnabled` - `true` if chains should be drawn straight, `false` otherwise.
Sample Graphs:
 `false` `true`

### setComponentLayouterEnabled

`public void setComponentLayouterEnabled(boolean enabled)`
Specifies whether or not the `LayoutStage` used for arranging the components of the graph is activated.

Overrides:
`setComponentLayouterEnabled` in class `CanonicMultiStageLayouter`

`BalloonLayouter` can only handle single components. Disabling `ComponentLayouter` will lead to errors during execution.
Default Value:
The default value is true. The stage that arranges connected graph components is activated.
Parameters:
`enabled` - `true` if the stage that arranges the graph components is activated, `false` otherwise
`CanonicMultiStageLayouter.isComponentLayouterEnabled()`, `CanonicMultiStageLayouter.setComponentLayouter(LayoutStage)`, `ComponentLayouter`

### setGroupNodeHidingEnabled

`public void setGroupNodeHidingEnabled(boolean groupNodeHidingEnabled)`
Specifies whether or not the `LayoutStage` used for hiding group nodes is activated.

Overrides:
`setGroupNodeHidingEnabled` in class `CanonicMultiStageLayouter`

`BalloonLayouter` cannot handle group nodes. Disabling `GroupNodeHider` will lead to errors during execution.
Default Value:
The default value is true. The stage responsible for hiding group nodes is activated.
Parameters:
`groupNodeHidingEnabled` - `true` if the stage used for hiding group nodes is activated, `false` otherwise
`CanonicMultiStageLayouter.isGroupNodeHidingEnabled()`, `CanonicMultiStageLayouter.setGroupNodeHider(LayoutStage)`, `GroupNodeHider`

### setOrientationLayouterEnabled

`public void setOrientationLayouterEnabled(boolean enabled)`
Specifies whether or not the `LayoutStage` that modifies the orientation of the layout is activated.

Overrides:
`setOrientationLayouterEnabled` in class `CanonicMultiStageLayouter`

If the current layout orientation is `LayoutOrientation.TOP_TO_BOTTOM`, the orientation of the layout will not be modified.

Based on the undirected layout style, disabling `OrientationLayouter` has no significant effect.
Default Value:
The default value is true. The orientation `LayoutStage` is activated.
Parameters:
`enabled` - `true` if the stage that modifies the orientation is activated, `false` otherwise
`CanonicMultiStageLayouter.isOrientationLayouterEnabled()`, `CanonicMultiStageLayouter.setOrientationLayouter(LayoutStage)`, `CanonicMultiStageLayouter.setLayoutOrientation(byte)`, `OrientationLayouter`

### setParallelEdgeLayouterEnabled

`public void setParallelEdgeLayouterEnabled(boolean enabled)`
Specifies whether or not the `LayoutStage` used for routing parallel edges is activated.

Overrides:
`setParallelEdgeLayouterEnabled` in class `CanonicMultiStageLayouter`

`BalloonLayouter` cannot handle parallel edges. Disabling `ParallelEdgeLayouter` will lead to errors during execution.
Default Value:
The default value is true. The stage that routes parallel edges is activated.
Parameters:
`enabled` - `true` if the stage responsible for routing parallel edges is activated, `false` otherwise
`CanonicMultiStageLayouter.isParallelEdgeLayouterEnabled()`, `CanonicMultiStageLayouter.setParallelEdgeLayouter(LayoutStage)`, `ParallelEdgeLayouter`

### setSelfLoopLayouterEnabled

`public void setSelfLoopLayouterEnabled(boolean enabled)`
Specifies whether or not the `LayoutStage` used for routing self-loops is activated.

Overrides:
`setSelfLoopLayouterEnabled` in class `CanonicMultiStageLayouter`

`BalloonLayouter` cannot handle self-loops. Disabling `SelfLoopLayouter` will lead to errors during execution.
Default Value:
The default value is true. The stage that routes self-loops is activated.
Parameters:
`enabled` - `true` if the stage responsible for routing self-loops is activated, `false` otherwise
`CanonicMultiStageLayouter.isSelfLoopLayouterEnabled()`, `CanonicMultiStageLayouter.setSelfLoopLayouter(LayoutStage)`, `SelfLoopLayouter`

### doLayoutCore

`public void doLayoutCore(LayoutGraph graph)`
Arranges the given graph as a tree graph in a balloon-like fashion.

Specified by:
`doLayoutCore` in class `CanonicMultiStageLayouter`

The given graph will not be copied during the layout process and the layout will be immediately applied to the given graph. This method is not side effect free in the sense that the order of edges or nodes in the input graph may change during the layout process.
Parameters:
`graph` - the input graph
Throws:
`WrongGraphStructure` - if the given graph is not a tree

### canLayoutCore

`public boolean canLayoutCore(LayoutGraph graph)`
This layout algorithm accepts only graphs that are trees.

Specified by:
`canLayoutCore` in class `CanonicMultiStageLayouter`

To apply this layout algorithm to general graphs, append `TreeReductionStage`.
Parameters:
`graph` - the input graph
Returns:
`true` if the given graph is a tree, `false` otherwise
`Trees.isTree(Graph)`

### getInfo

`protected BalloonLayouter.NodeInfo getInfo(Node node)`
Returns the `BalloonLayouter.NodeInfo` object associated with the given node while the layout algorithm is active.

The returned object contains detailed information describing the placement of a node in the layout being computed, e.g., a node's distance to its parent or the wedge angle of the subtree rooted at a node.

Subclasses may want to override this method to realize another node information setup. This method is called throughout the algorithm, each time some information associated with a node needs to be retrieved or stored.

Parameters:
`node` - the node whose information object should be retrieved
Returns:
the `BalloonLayouter.NodeInfo` instance associated to the given node
`BalloonLayouter.NodeInfo`

### determineRoot

`protected Node determineRoot()`
Determines the root node of `graph` according to the chosen `root node policy`.

This method may be overridden to implement some other strategy for choosing the root node of the input graph. It is called before the rest of the layout process within `doLayoutCore(LayoutGraph)`.

If the `root node policy` is set to `SELECTED_ROOT` and more than one node is marked as potential root node, only one will be considered as root. If no nodes are selected, the root node will be defined according to `Trees.getRoot(Graph)`.
Returns:
the root node of `graph`
`setRootNodePolicy(byte)`

### calcChildArrangement

`protected void calcChildArrangement(Node root)`
Calculates a child node arrangement for a given root node of the tree.

During the arrangement, child nodes of `root` will be `sorted`. Furthermore, distances of the child nodes will be chosen such that the wedge of the subtree of `root` fits into the preferred wedge angle, which is either defined via `setPreferredRootWedge(int)` or `setPreferredChildWedge(int)`. Calculated distances are stored in `BalloonLayouter.NodeInfo.dist`.

The angle values - upper and lower wedge angle - may also be updated during this process and stored in `BalloonLayouter.NodeInfo.upperAngle` and `BalloonLayouter.NodeInfo.lowerAngle`, respectively. To compute the angles of wedges, method `calcAngles(Node)` is used.

This method may be overridden to perform a custom child node arrangement. If support for available features like `interleaving` should be maintained, then these features need to be carefully considered during the arrangement.

Parameters:
`root` - the node for whose children to compute an arrangement

### sortChildNodes

`protected void sortChildNodes(Node root)`
Sorts the child nodes (successors) of the given node.

This implementation uses the original node coordinates if `From Sketch mode` is enabled. Otherwise it uses `the specified comparator` to sort the outgoing edges and thus the children of `root`. If there is no such comparator, then the sorting depends on whether or not the child nodes are placed in an `interleaved` fashion:

• Normal: Children are sorted according to the chosen `child ordering policy`.
• Interleaved: Children are sorted such that the resulting interleaved node placement is compact, while children inducing larger subgraphs are placed next to smaller ones.

This method may be overridden to realize a custom child node ordering. It gets called in method `calcChildArrangement(Node)` before coordinates are assigned and just after the wedge sizes for all subtrees rooted at `root` are determined.

Parameters:
`root` - the node whose child nodes will be sorted

### getPreferredChildWedge

`protected double getPreferredChildWedge(Node root)`
Returns the preferred radial amount (wedge) in degrees that child nodes may in total occupy around the given node.

The wedge angle controls the degree to which the child nodes may radiate from the center of layout. A value close to `360` means that the child nodes may radiate in (almost) any direction from their parent node, edge lengths can in consequence stay rather small. On the other hand, a small value means that children are restricted to a small angle; thus, edges lengths (and drawings) may become large.

This method returns the `preferred root wedge` if node `root` was selected as global root node (`setRootNodePolicy(byte)`). Otherwise, it either returns `getPreferredChildWedge()` or if the given node has an outdegree equal to `2`, it returns the minimum of `getPreferredChildWedge()` and `180`.

This method may be overridden to provide a custom child wedge function.

Parameters:
`root` - the node to get the preferred wedge angle for
Returns:
the preferred wedge angle for `root` in degrees
`setPreferredChildWedge(int)`, `setPreferredRootWedge(int)`

### calcAngles

`protected double calcAngles(Node root)`
Calculates the wedge angle that has to be reserved for the subtree rooted at the given node.

Given some `distance` the `upper angle` and `lower angle` of the wedge belonging to the subtree rooted at `root` will be calculated and stored in the `BalloonLayouter.NodeInfo` instance associated with `root` (`getInfo(Node)`).

This method is a convenience method to calculate the wedge angle without any scaling to the node `distance`. It calls `calcAngles(Node, double)` with a scaling factor of `1.0`.

This method may be overridden to perform a custom wedge angle assignment scheme. The method is called when `arranging child nodes`. Large edge labels on the incoming edge to `root` need to be considered, if `integrated edge labeling` should still work properly.

Calling this method may change data in the `node information instance` associated with node `root`.
Parameters:
`root` - the node for which the wedge angles are calculated
Returns:
the sum of the upper and lower wedge angle of the subtree rooted at node `root`
`calcAngles(Node, double)`, `calcChildArrangement(Node)`

### calcAngles

```protected double calcAngles(Node root,
double scaleFactor)```
Calculates the wedge angle that has to be reserved for the subtree rooted at the given node scaling the `distance` with the given scale factor.

Given some `distance` the `upper angle` and `lower angle` of the wedge belonging to the subtree rooted at `root` will be calculated and stored in the `BalloonLayouter.NodeInfo` instance associated with `root` (`getInfo(Node)`).

This method may be overridden to perform a custom wedge angle assignment scheme. The method is called when `arranging child nodes`. Large edge labels on the incoming edge to `root` need to be considered, if `integrated edge labeling` should still work properly.

Calling this method may change data in the `node information instance` associated with node `root`.
Parameters:
`root` - the node for which the wedge angles are calculated
`scaleFactor` - a factor to be applied to the `distance` of `root`
Returns:
the sum of the upper and lower wedge angle of the subtree rooted at the given root node
`calcChildArrangement(Node)`