# Mainline Tree layout reference

Mainline Tree is a tree layout algorithm that applies to any type of diagram.

This layout algorithm arranges the junctions and edges in the input network diagram hierarchically along a main line and places its related branches on the left side, the right side, or both sides of the main line.

Root and end junctions can be specified in the diagram so the Mainline Tree layout algorithm will build a main line starting at a specified root junction and ending at a specified end junction.

• By default, when no root and end junctions are specified, the algorithm identifies the diagram junction associated with the smallest network topology index. Starting from this junction representing the root, the algorithm searches for a line composed of the greatest number of edges: the main line.
• When a root junction is set, the main line is one of the branches composed of the greatest number of edges starting from this root junction.
• When both root and end junctions are specified and there is a path between them, the main line is the branch composed of the greatest number of diagram edges starting from this root junction and ending at this end junction.

If your network diagram is composed of several disconnected diagram parts, you can define several root and end junctions, for example, one for each part of the diagram.

Several junctions that belong to the same connected diagram part can also be specified as roots. They are all aligned along the same axis perpendicularly to the tree direction and appear as different start points for a tree branch of the diagram. For end junctions, although nothing prevents you from specifying several ends on the same connected diagram part, the system identifies only one of them as the end junction.

If an end junction is specified but no root junction is specified, the end junction is ignored.

The examples below show a diagram before and after applying the Mainline Tree layout, respectively:

## Apply the Mainline Tree layout on an active diagram map view

When applying a layout on a network diagram, the following prerequisites must be met:

• Since this operation is transactional, edits must be saved before it is run.
• The input network diagram layer to which the layout applies must be from either a utility network or trace network in a file geodatabase or a network diagram service. When working with a utility network in an enterprise geodatabase, the input network diagram layer must be from a service.

To apply the Mainline Tree layout on an active diagram map view, do one of the following:

• On the Network Diagram tab, click the drop-down arrow on the Diagram Layouts button in the Layout group, and click the Mainline Tree layout item in the gallery.
• Load the Apply Mainline Tree Layout tool in the Geoprocessing pane.

Then, adjust the Mainline Tree layout parameters and click Run.

##### Note:

To apply the layout on a subset of features in the network diagram, use one of the Select Features tools (for example, Select By Rectangle, Select By Polygon, and so on) and select the diagram features before running.

## Configure the Mainline Tree layout on a diagram template

To configure this layout on your diagram template, use the Add Mainline Tree Layout tool.

## Mainline Tree layout parameters

The sections below clarify the Mainline Tree diagram layout parameters.

### Preserve container layout

Most of the layout algorithms work with the Preserve container layout option. This option allows controlling the algorithm execution so it executes either on the top graph of the diagramPreserve container layout checked, or on both content and noncontent features in the diagram—Preserve container layout unchecked.

### Tree Direction

This parameter sets the direction of the main line:

### Branches Placement

This parameter specifies how branches from the main line are relatively placed with regard to its direction:

### Spacing values interpreted as absolute units in the diagram coordinate system

Some layout algorithms work with the Spacing values interpreted as absolute units in the diagram coordinate system option. This option specifies how the layout algorithm parameters representing distances will be interpreted:

• Checked—The layout algorithm will interpret any distance values as linear units.
• Unchecked—The layout algorithm will interpret any distance values as relative units to an estimation of the average of the junction sizes in the current diagram extent. This is the default.

### Between Junctions Perpendicular to the Direction

This parameter is used to set the spacing between diagram junctions that are displayed along the axis perpendicular to the main line, that is, the A spacing shown below:

### Between Junctions Along the Direction

This parameter value specifies the spacing between diagram junctions that are displayed along the main line, as well as the spacing between diagram junctions that are displayed along the axis parallel to the main line, that is, the B spacing shown below:

### Between Disjoined Graphs

This parameter is used to specify the minimum spacing that must separate features belonging to disjoined graphs when the diagram contains such graphs, that is, the C spacing shown below:

### Edge Display Type, Break Point Relative Position, and Offset

Learn about the Edge Display Type, Break Point Relative Position, and Offset parameters