Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Lay Out a Diagram Automatically

As you develop a diagram, it can become difficult to position the elements and connectors so that the layout and organization remain clear. Rather than continually moving structures around manually, you can simply select a 'Layout Diagram' option to automatically reposition all the structures on the diagram in a logical, tree-based structure. If your diagram is complex, you can then do some manual 'tweaking' to draw out particular elements and relationships.

Generally the default layout parameters provide adequate layouts for a wide range of diagrams, but for a fine degree of control you can also set layout parameters using the 'Diagram Layout Options' dialog.

Access <open diagram> | Diagram | Layout Diagram

<open diagram> | diagram toolbar: Auto Layout

Double-click background > Diagram: Set Layout Style

Apply Layout Configurations

Options/Buttons

Action

See also

Cycle Remove Options

These settings remove cycles in the element organization (where element X is the source of a path but also becomes the target of a branch of the path), by reversing the connectors that impose the cycling and then reorganizing the diagram and reinstating the reversed relationships; this identifies the primary source element in the diagram. Select:

  • Greedy - to use the Greedy Cycle Removal algorithm, which minimizes the number of connectors reversed
  • Depth First Search - to use the Depth First Search Cycle Removal algorithm, which establishes the longest linear sequence possible before establishing parallel sequences and branches; this algorithm is less effective in large and/or complex diagrams, but produces a more natural layout than the Greedy algorithm

Crossing Reduction Options

These options determine the length of time the routine searches for ways of reorganizing the layout to avoid crossed relationships:

  • Iterations - Type the number of iterations to be used during cycle removal (more than 8 does not usually provide any improvement)
  • Aggressive - Select this checkbox to use an aggressive (detailed and time-consuming) crossing reduction step

Layering Options

These settings determine how elements are organized in layers during layout. Select:

  • Longest Path Sink - to use the Longest Path Sink Layering algorithm, where the final target elements (sinks, which have no relationships issuing from them) are arranged in a layer at the top of the diagram, and the relationship paths built downwards from there in as many layers as there are nodes in the longest path
  • Longest Path Source - to use the Longest Path Source Layering algorithm, where the original source elements (those with no relationships entering them) are arranged in a layer at the bottom of the diagram and the relationship paths built up from there in as many layers as there are nodes in the longest path
  • Optimal Link Length - to use the Optimal Link Length Layering algorithm, which organizes the elements into the number of layers that minimizes the total source-to-sink relationship chain; in this layout you can have both source elements and sink elements at various levels of the diagram

Layout Options

These settings define how far apart the element layers and columns are in the layout.

  • Layer Spacing - Type the default number of logical units between layers of elements (vertical spacing)
  • Column Spacing - Type the default number of logical units between elements within a layer (horizontal spacing)

Initialize Options

The autolayout routine inserts line waypoints and connectors into relationship paths to help plot the direction of the relationships; the routine then assigns an index number to every node, such that nodes in the same layer are numbered left to right. These settings determine how those index numbers are assigned. Select:

  • Naive - to use the Naive Initialize Indices algorithm, which assigns index numbers to nodes as they are encountered in a sweep and tends to place all waypoints to the right of real nodes (and therefore long relationships between a small number of elements to the right of chains of short relationships between several elements)
  • Depth First Search Outward - to use the Depth First Out Initialize Indices algorithm, which assigns index numbers to nodes as they are encountered in a depth first search from source nodes outwards (and would therefore place longer relationship chains to the left of shorter chains, with the primary source node at the start of the diagram flow)
  • Depth First Search Inward - to use the Depth First In Initialize Indices algorithm, which also assigns index numbers to nodes as they are encountered in a depth first search, but from sink nodes inwards (and would therefore place longer relationship chains to the left of shorter chains, with the ultimate target node at the end of the diagram flow)

Direction

Select the direction in which all directed connectors should point, to set the position of the primary source element and the overall flow of the diagram. That is, Up, Down, Left, or Right.

Set as Project Default

Select this checkbox to apply the diagram layout settings to all diagrams in the project.

If you later define different settings and select this checkbox, the new settings override all those saved previously.

OK

Click on this button to save your settings.

Example

This illustration shows an automatically laid out diagram with these options set:

  • 'Depth First Search'
  • 'Optimal Link Length'
  • 'Depth First Search Outward'
  • 'Direction - Up'

Notes

  • This facility is available for all types of diagram other than Timing and Interaction Overview diagrams
  • If you decide that the autolayout is not appropriate, you can reverse it before saving the diagram; click Ctrl+Z

Learn more