# Diagram layouts

Network diagrams can be difficult to read when the proximity between diagram features is too close or too distant to display the symbols and labels at the desired scale. A set of diagram layouts can be applied to clarify and normalize spacing between features in network diagrams.

## Types of diagram layouts

Various diagram layout algorithms are provided to lay out your network diagram contents.

There are four categories of layouts: tree, refinement, schematic, and others.

### Tree layouts

Tree layouts hierarchically arrange the diagram features displaying a tree structure. The following are the tree layouts:

• Mainline Tree layout

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.

This layout algorithm arranges the diagram features hierarchically and places them in a radial tree according to the specified radius parameters. It works from a root junction that it uses as the circle center to arrange the subtrees starting from this root in concentric circles, each circle corresponding to one hierarchical level.

• Smart Tree layout

This layout algorithm arranges the diagram features hierarchically and places them in a smart tree according to the direction and spacing distances specified.

### Refinement layouts

Refinement layouts include the following three diagram layouts that refine diagram edges:

• Angle Directed layout

This layout algorithm progressively moves the diagram's edges in specified alignment directions. For each diagram edge, this layout notes its current direction, searches for the nearest desired direction among those specified, and moves the edge in that direction.

• Partial Overlapping Edges layout

This layout algorithm detects sets of collinear edges or collinear portions of edges (edge segments) that can be considered as being inside a buffer zone of a given size.

• Reshape Diagram Edges layout

This layout is used to process simple operations on vertices along edges in network diagrams. It allows you to do the following:

• Remove all vertices along diagram edges.
• Reduce some vertices along diagram edges.
• Square diagram edges with the addition of vertices on edges.
• Separate diagram edges that overlap.
• Detect diagram edges that cross each other at right angles and reshape their geometries to display a circular arc at the crossing locations.

### Schematic layouts

Schematic layouts include several types of layouts. Most of them allow the separation of features that are visually close in the network diagram while preserving the position of these features as much as possible, for example, Grid, Linear Dispatch, Spatial Dispatch, and Force Directed. The two others, Rotate Tree and Compression, are used to optimize space in the diagram.

• Compression layout

This layout algorithm compresses the diagram features toward the middle of the diagram while trying to maintain relative positioning. It works from a distance that allows it to build junction groups that are moved as super nodes during the algorithm execution.

• Force Directed layout

This layout algorithm uses a physical analogy to draw graphs by identifying a force system in which it tries to locally minimize the energy. It searches for an equilibrium state of the force system—a position for each diagram junction where the total force on each junction is zero.

• Grid layout

This algorithm positions diagram junctions relative to a magnetic grid that has cell sizes fixed by the Cell Width and Cell Height parameter values.

• Linear Dispatch layout

This layout algorithm adds space between diagram junctions that are visually too close, overlapping, or coincident. It moves junctions along their connected edges. The movement along the edges depends on the current and relative position of junctions and on the layout parameters.

• Main Ring layout

This layout algorithm arranges the diagram features around the main ring and hierarchically lays out the subset of diagram features that connect to each diagram junction placed along the main ring.

• Relative Mainline layout

This layout arranges the network diagram features in the active diagram along parallel straight lines, with all the connected edges having the same attribute value. It also places the branches from those lines, preserving their directions regarding the straight lines and the distances proportional to the initial distance and relative to each other.

• Rotate Tree layout

This layout algorithm rotates the tree or trees related to the pivot junctions currently set up in the input network diagram layer according to the specified angle.

• Spatial Dispatch layout

This layout algorithm progressively separates diagram junctions that are visibly close to overlapping according to their current positions and to the shift factor specified.

### Other layouts

This category contains the following specific algorithms:

• Template layouts

This layout can be used to re-execute the list of layout algorithms currently configured on the template on which the input network diagram is based. This tool is useful when a diagram has been edited and you want to restore the layout to what it was when the diagram was generated.

• Geo Positions layout

This layout algorithm moves each diagram junction and edge feature to match the geographical positions of the associated network features in the map view.

## Diagram layouts specifics

Diagram layout algorithms are executed using geoprocessing tools. Each layout comes with its own parameters that allow controlling spacing between diagram features, edge geometry, maintain position of content features, and so on. Some layouts also consider diagram flags that may have been positioned in the diagram before their execution.

### Apply a diagram layout

Diagram layouts are executed with geoprocessing tools.

There are two ways to apply a diagram layout:

• Manually

Use this method when you want to apply a layout to an existing network diagram currently displayed in a diagram map view. In this case, the layout can apply to either the entire content of the network diagram or a part of it (a subset of selected diagram features).

• Automatically at diagram generation

This is set on the diagram template so any diagram based on this template is dynamically laid out. The layout always applies to the entire content of the diagram based on that template. In this case, several layouts can be configured on the template. They are chained in the entry sequence order in which they were configured on the template. Layout#1 runs on the initial geometry of the network features in the diagram, and layout#N works from the geometry resulting from the execution of the algorithm#(N-1).

### Layout parameters

A diagram layout runs according to parameters that are unique to each layout.

Each layout has its own default values for each parameter that you can modify if necessary. These default parameter values can also be preset per template if needed.

When a layout algorithm tool is loaded in the Geoprocessing pane, it uses its default parameter values unless the input network diagram on which the layout will be executed is based on a template for which the layout algorithm was explicitly configured with other parameter values.

When a layout algorithm is run on a diagram using Python scripts, it may not be necessary to specify each algorithm parameter value. Without specified parameter values, the layout will run with either the algorithm parameter default values or the algorithm parameter values set on the template on which the input diagram is based when this algorithm was added to the template.

### Running diagram layouts in asynchronous mode on the server

By default, all diagram layouts execute synchronously both on the client and server. However, depending on the diagram size, the complexity of the layout algorithm, and the time-out specified for the service (600 seconds by default), some layout executions can exceed the service time-out and make the operations fail. In this situation, applying layouts asynchronously may be necessary.

When applying a diagram layout with the Run in asynchronous mode on the server option enabled, the process stays synchronous on the client side in regard to the edited diagram; that is, no other operations can be processed on that diagram until the layout execution completes. However, the process is executed asynchronously on the server by dedicating server resources to run the layout algorithm with a longer time-out. This mode prevents the client from blocking other operations while the asynchronous layout operation completes, allowing you to create or work on other diagrams during this time.

##### Note:

This asynchronous mode only works when consuming utility network services published on ArcGIS Server 10.7.1 Enterprise.

### Lay out content features

Most of the layout algorithms work with a specific option, Preserve containers, that allows you to control the algorithm execution on content features. Keep the following in mind when using the Preserve containers option:

• When this option is checked, the layout algorithm executes on the top graph of the diagram and preserves the relative position of the following:
• All content features related to a structure junction, or a device assembly inside its structure device or assembly diagram polygon container.
• All content features related to a linear container around its diagram linear container. These are drawn alongside the linear container.
• When this option is not checked, the layout algorithm executes on both the content and noncontent features in the diagram.

### Diagram flags and layouts

Before they execute, some layouts consider diagram flags that may exist in the diagram. There are four types of diagram flags you can use in a diagram: root junction flags, end junction flags, pivot junction flags, and barrier flags.

#### Root junction flags

The tree layout algorithms start processing from certain junctions deemed tree roots. When the diagram is composed of disconnected network parts, the tree layouts systematically build disconnected trees, each one starting from one root junction.

Root junction flags can be set at diagram generation or update when the template on which the diagram is based is configured to run a Set Root Junction rule. The Set Root Junction tool can also be used to set junctions as roots so the tree layouts process from those junctions.

When no root junctions are set in the diagram, the tree layouts set the necessary junctions at random.

In all cases, the tree layouts set root junctions at the following positions:

• The Radial Tree layout places the root junction at the center of a circle and arranges the subtrees starting from this root in concentric circles. Each circle corresponds to one hierarchical level.
• The Mainline Tree layout builds its mainline from the specified root junction.
• The Smart Tree layout starts its tree building from the specified root junction.

When the diagram is composed of several disconnected graphs or there are several root junctions specified in the diagram, the following positions are used:

• The Radial Tree layout places the root junctions around a first concentric circle whose center is fictive.
• The Mainline Tree layout and Smart Tree layout align the root junctions along the same axis perpendicularly to the tree direction so they appear as different starting points for each disconnected graph or for different tree branches of the graph.

#### End junction flags

For the Mainline Tree layout, there is also an end junction—the last junction on the mainlines—to consider.

As with root junctions, these specific junctions can be set using the Set End Junction tool, or they can be determined by the algorithm. In the latter case, each end junction is the last junction of the longest branch starting from a root junction—that is, the longest branch considering the number of edges along that branch.

#### Pivot junction and barrier flags

Before applying the Rotate Tree layout, you must flag the junctions around which you want the rotation to operate using the Set Pivot Junction tool. In addition, if you want to control the rotation layout and prevent it from executing beyond specific diagram features, you may need to set up barrier flags on those features using the Set Barrier tool.