Class GraphLayoutLineWrapper

Class GraphLayoutLineWrapper is a layout algorithm that can be used to "line-wrap" respectively "column-wrap" a graph layout. It allows, for example, to specify a desired aspect ratio for a wrapped layout, or a fixed width (height) for the lines (columns) of a wrapped layout.

GraphLayoutLineWrapper is realized as a layout stage, i.e., it is an extension of abstract class AbstractLayoutStage.

Most commonly, class GraphLayoutLineWrapper is used in conjunction with hierarchical layouts. Figure 10.9, “Hierarchical layout before and after line-wrapping” presents a hierarchical layout that has been line-wrapped to achieve a desired aspect ratio.

Figure 10.9. Hierarchical layout before and after line-wrapping

Sample hierarchical layout.
Extended hierarchical left-to-right layout.
The same graph line-wrapped.
The same graph line-wrapped so that width and height are nearly the same, i.e., an aspect ratio of 1.0 is nearly achieved.

Example 10.17, “Using GraphLayoutLineWrapper in conjunction with hierarchical layout” shows how class GraphLayoutLineWrapper can be used to wrap hierarchical top-to-bottom layouts.

Example 10.17. Using GraphLayoutLineWrapper in conjunction with hierarchical layout

GraphLayoutLineWrapper gllw = new GraphLayoutLineWrapper();
gllw.ColumnMode = true;
gllw.Mirror = false;
// Use grouping-aware hierarchical layout as the core layouter.
gllw.CoreLayouter = new IncrementalHierarchicLayouter();

// Invoke the layouter.
graph.ApplyLayout(gllw);

Layout Options

GraphLayoutLineWrapper provides a set of options that influence its behavior.

Column Mode
API
bool ColumnMode { get; set; }
Description Determines whether the graph layout should be column-wrapped instead of line-wrapped.
Spacing
API
double Spacing { get; set; }
Description Defines the spacing between adjacent lines (columns) of the line-wrapped (column-wrapped) graph layout.
Edge Spacing
API
double EdgeSpacing { get; set; }
Description Defines the spacing between adjacent edge paths that connect consecutive lines (columns) of the line-wrapped (column-wrapped) graph layout.
Mirroring
API
bool Mirror { get; set; }
Description Determines whether the lines (columns) of the line-wrapped (column-wrapped) graph layout should be arranged in an alternating manner so that every second line (column) goes from right to left (bottom to top) instead of left to right (top to bottom).
Pre-set vs. Automatic Line Width (Column Height)
API
bool FixedWidthLineBreaks { get; set; }
Description Determines whether the lines (columns) of the line-wrapped (column-wrapped) graph layout should use the width (height) as set using FixedWidth.
Fixed Line Width (Column Height)
API
double FixedWidth { get; set; }
Description Defines the width (height) that should be used for the lines (columns) of the line-wrapped (column-wrapped) graph layout. This setting only has an effect if pre-set line width (column height) is enabled.
Aspect Ratio
API
double TargetRatio { get; set; }
Description Defines the desired aspect ratio that should be achieved for the line-wrapped (column-wrapped) graph layout. This setting only has an effect if automatic line width (column height) is enabled.