documentationfor yFiles for HTML 3.0.0.2

ComponentLayout

Represents a layout algorithm that arranges the connected components of a graph, allowing for the use of different layout styles and customization for component and edge arrangement.

Inheritance Hierarchy
LayoutStageBase
ComponentLayout
Implemented Interfaces

Remarks

Layout Style

The arrangement of components can be customized through various styles. Most styles, except NONE and KEEP_CENTERS, ensure that components are placed without overlapping. These styles allow for flexible and clear visual arrangements of subgraphs.

Layout with orthogonal components using MULTI_ROWS_COMPACT

Concept

ComponentLayout is a ILayoutStage that can wrap and work with another ILayoutAlgorithm. This enables support for disconnected graphs by applying the layout algorithm to each component (subgraph) individually. The wrapped coreLayout handles each component's internal arrangement.

The general process followed by ComponentLayout includes:

  1. Identify the connected components within the graph.
  2. Temporarily hide all components of the graph.
  3. For each component:
    1. Unhide the component.
    2. Apply the coreLayout to arrange the component.
    3. Hide the component again.
  4. Unhide all components after processing.
  5. If a style other than NONE is specified, arrange the components in the layout space.
  6. Compute routes for edges that connect nodes from different components. The routing of these "inter-edges" can be customized via the interEdgeRouter property.

Features

To arrange the subgraphs of the components, ComponentLayout uses mappings defined by the componentLayouts, which can specify a distinct ILayoutAlgorithm for each component. If no specific algorithm is assigned, the coreLayout is used. If the core layout is not specified, components maintain their existing locations while being arranged spatially.

Grouped graphs are treated specially. All contents of a group node remain part of the same component as the group itself, ensuring internal consistency. To alter this behavior, grouping can be disabled via the considerGrouping property.

By default, components correspond to connected nodes in the graph. Custom subgraphs can be defined by assigning component IDs to nodes using the layout data property componentIds.

Node types, as defined by nodeTypes, can also be used to influence the arrangement. If all nodes in a component share the same node type, the component is classified under that type. Components of the same type are typically positioned near each other, but only certain styles — such as ROWS, SINGLE_ROW, SINGLE_COLUMN, and MULTI_ROWS_TYPE_SEPARATED — actively prioritize type-based ordering. Other styles focus on different criteria, such as compactness, and may not guarantee proximity of similar types.

Default Values of Properties

componentSpacing45
considerGroupingtrueGrouping information is considered for determining the components.
edgeLabelPlacementCONSIDEREdge labels are considered
gridSpacing0No grid is considered.
interEdgeRouternullEdges are routed as straight lines from source to target.
nodeLabelPlacementCONSIDERNode labels are considered
preferredSizeSizeBoth preferred width and height are 400.
styleROWS

Type Details

yFiles module
algorithms

See Also

Constructors

Properties

Methods

Constants