C

CompactDiskLayout

This layout algorithm arranges a graph on a disk packing the nodes as dense as possible.
ImplementsInheritance Hierarchy

Remarks

Layout Style

The nodes are arranged on a disk such that the disk's radius is minimized. The layout mostly optimizes the dense placement of the nodes, while edges play a minor role. Hence, the compact disk layout is mostly suitable for graphs with small components whose loosely connected nodes should be grouped and packed in a small area.

Concept

The CompactDiskLayout arranges the nodes on a disk from the inside out packing them as dense as possible. During this iterative process it avoids node overlaps and label overlaps (if activated; see nodeLabelPlacement). In particular, to keep the layout compact the CompactDiskLayout may decide to place a single node or multiple nodes in the center of the disk.

Features

Connected Components

By default, the CompactDiskLayout takes the connected components for the placement of the nodes into account. In that case the nodes of the same component are placed sequentially in the iterative placement process ensuring that they form a visual component. Input graph consisting of multiple components. Compact disk layout.

Node Types

If nodeTypes are defined, the CompactDiskLayout takes these into account instead of the connected components. In particular, nodes of the same type are placed closely together forming a visual component. Input graph with node types 'A', 'B' and 'C'. Compact disk layout taking the node types for the placement of the nodes into account.

From Sketch

Use fromSketchMode to take the coordinates of the input diagram into account when arranging the nodes on the disk. Input graph where the nodes are roughly placed on circles. Compact disk layout taking the coordinates of the input diagram into account.

Node Labeling

The CompactDiskLayout allows for integrated node labeling. Node labels are placed automatically without generating overlaps with other labels or graph elements.

Port Placement Constraints

This layout algorithm handles port placement constraints by applying the PortPlacementStage as a postprocessing step.

Layout Stages

This class provides a configurable pipeline that contains various ILayoutStages. Each ILayoutStage can incorporate preprocessing or postprocessing steps into the layout calculation to streamline the input graph and enhance the resulting layout. Additionally, custom ILayoutStages can be added and executed either before or after the predefined ones.

The following default ILayoutStages are included:

With these layoutStages the layout algorithm is configured well, so they usually don't need to be changed.

Default Values of Properties

NameDefaultDescription
edgeLabelPlacementRadialEdgeLabelPlacement.IGNORE
Edge labels are placed by an independent labeling algorithm.
fromSketchModefalse
The layout algorithm does not consider the initial coordinates of the nodes.
minimumNodeDistance0
nodeLabelPlacementNodeLabelPlacement.CONSIDER
Node labels are considered.

See Also

Developer's Guide

Members

Show:

Constructors

Creates a new CompactDiskLayout instance with the default settings.

Parameters

Properties

Gets or sets how the layout handles the position of edge labels.
conversionfinal

Property Value

IGNORE if the edge labels are ignored by the layout algorithm, and GENERIC if the edge labels are placed by the GenericLabeling algorithm subsequently.

Default Value

The default value is: RadialEdgeLabelPlacement.IGNORE
Edge labels are placed by an independent labeling algorithm.
Gets or sets whether or not to take the coordinates of the input diagram into account when arranging the nodes on the disk.
If enabled: The layout algorithm tries to find a placement of the nodes on concentric circles such that it reflects the radial ordering as well as the distances of the nodes to the center of the input layout as good as possible.
final

Property Value

true if the initial coordinates of the nodes are used, false otherwise

Default Value

The default value is: false
The layout algorithm does not consider the initial coordinates of the nodes.

Sample Graphs

ShownSetting: Input graph where nodes are roughly placed on circles.

See Also

Developer's Guide
Gets or sets the minimum node distance that this algorithm should enforce between all pairs of nodes.
The minimum node distance needs to be non-negative.
final

Property Value

a non-negative minimum distance between nodes

Throws

Exception ({ name: 'ArgumentError' })
if the specified minimum node distance is negative

Default Value

The default value is: 0

Sample Graphs

ShownSetting: node distance 0

See Also

Developer's Guide
Gets or sets how the layout handles the position of node labels.
Optimal label placement with integrated labeling can be achieved using a label model which allows free placement of node labels.
conversionfinal

Property Value

  • IGNORE if node label positions relative to their owner should be maintained and ignored during the layout process.
  • CONSIDER if node label positions relative to their owner should be maintained and considered for the placement of other graph elements to avoid overlaps.
  • HORIZONTAL if horizontal node label positions should be calculated by this layout algorithm, assuring that no overlaps occur.
  • RAY_LIKE if ray-like node label positions should be calculated by this layout algorithm, assuring that no overlaps occur.
  • RAY_LIKE_LEAVES if a mix of horizontal and ray-like node label positions should be calculated by this layout algorithm, assuring that no overlaps occur.
  • GENERIC if the node labels should be placed by the GenericLabeling algorithm subsequently.

Default Value

The default value is: NodeLabelPlacement.CONSIDER
Node labels are considered.

Sample Graphs

ShownSetting: IGNORE

See Also

Developer's Guide
Gets or sets the spacing used for node labels when integrated node labeling is enabled.

This spacing specifies the distance between labels associated with the same node (if there are multiple labels). In addition, for ray-like labels of outermost nodes, the spacing also defines the distance between the labels and the node they belong to (e.g. for ray-like label placement).

The spacing must have a non-negative value.

The spacing value has an effect only if nodeLabelPlacement is set to one of HORIZONTAL, RAY_LIKE or RAY_LIKE_LEAVES.
final

Property Value

the non-negative node label spacing

Throws

Exception ({ name: 'ArgumentError' })
if the given spacing value is negative

Default Value

The default value is: 4.0

Sample Graphs

ShownSetting: Node label spacing set to 5.0

See Also

API
nodeLabelPlacement

Methods

Calculates a radial arrangement for the given graph.

Parameters

graph: LayoutGraph
the input graph
Calculates a radial arrangement for the given graph.
protectedfinal

Parameters

graph: LayoutGraph
the input graph
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the CompactDiskLayout.
The generic type arguments of the created layout data are compatible with instances of LayoutGraph, but the layout data is not bound to a specific graph instance. Therefore, the created layout data still has to be passed as an argument of applyLayout in order to be applied.

Parameters

graph: LayoutGraph
the graph that determines the generic type arguments of the created layout data

Return Value

CompactDiskLayoutData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel>
an instance of layout data that can be used to perform item-specific configurations for the given CompactDiskLayout.
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the CompactDiskLayout.
The generic type arguments of the created layout data are compatible with instances of IGraph, but the layout data is not bound to a specific graph instance. Therefore, the created layout data still has to be passed as an argument of applyLayout in order to be applied.
This method is not available unless the module view-layout-bridge is loaded. Either load the module 'view-layout-bridge' explicitly or ensure that the LayoutExecutor type is available at runtime.

Parameters

graph?: IGraph
the graph that determines the generic type arguments of the created layout data

Return Value

CompactDiskLayoutData<INode, IEdge, ILabel, ILabel>
an instance of layout data that can be used to perform item-specific configurations for the given CompactDiskLayout.