Compact Orthogonal Layout

Class CompactOrthogonalLayouter is a specialized variant of the orthogonal layout algorithm. It uses a divide-and-conquer approach to achieve compact orthogonal layouts that fit into, respectively are near, a desired aspect ratio.

In contrast to the majority of yFiles layout algorithms, class CompactOrthogonalLayouter does not inherit from CanonicMultiStageLayouter, but is instead an extension of abstract class AbstractLayoutStage.

CompactOrthogonalLayouter combines different phases that:

  1. find partitions in the node set of the graph
  2. calculate the orthogonal layout for the partitions
  3. arrange the partitions in a compact manner
  4. route the connecting edges between partitions

Figure 10.61. Sample layout produced by class CompactOrthogonalLayouter

Sample layout produced by class CompactOrthogonalLayouter
A compact orthogonal diagram with an aspect ratio of 1.0

Layout Options

This specialized layout algorithm provides only few options by itself. However, the respective classes that are used for the different layout phases can be customized individually. In particular, this also includes the orthogonal layout algorithm which is used as the core layouter.

Grid Spacing
int GridSpacing { get; set; }

Defines the virtual grid spacing used by the layouter. Each node is placed in such a way that its center point lies on a grid point.

Aspect Ratio
double AspectRatio { get; set; }

Specifies the desired aspect ratio that the resulting diagram should fit into. The algorithm tries to reach this value, depending on the actual graph structure, however, this may not always be feasible.

Applicable Layout Stages

Table 10.52, “Layout Stages” lists layout stages that can be used to enhance the layout process of class CompactOrthogonalLayouter.

Table 10.52. Layout Stages

Classname Description
PolylineLayoutStage With class CompactOrthogonalLayouter as the core layouter, this stage adds octilinear edge routing to the diagram that results from the orthogonal layout calculation.

Tutorial Demo Code

The layout module class CompactOrthogonalLayoutModule.cs from the LayoutModulesWindow demo application presents the setup of class CompactOrthogonalLayouter in an application context.