- I
Remarks
Layout Style
This layout algorithm arranges the nodes of a given graph such that each edge is drawn as an alternating sequence of horizontal and vertical segments.
It produces compact drawings with no overlapping nodes, few crossings and few bends and is well suited for small and medium-sized sparse graphs.
Orthogonal drawings are common in engineering applications since they are able to provide clear representations of complex networks that can also be optimal with respect to diverse objective functions such as bend minimization or area minimization. Application domains of orthogonal drawings include software engineering, database schema representation, system management, knowledge representation, VLSI circuits and floor planning applications.
This algorithm also optionally supports directed edge drawings (although not in combination with hierarchically nested graphs or the non-default layoutMode). Application domains of directed orthogonal drawings include, for example, software engineering, database schema and system management.
Also, this algorithm supports hierarchically nested graphs (although not in combination with the directed edge drawings, the from sketch option, or the non-default layoutMode):
Concept
The orthogonal layout algorithm is based on the topology-shape-metrics approach and runs in three phases:
- Planarization – A planar embedding is computed.
- Orthogonalization – The bends and the angles are computed.
- Compaction – The coordinates for the nodes and edges are determined.
Features
There exist several different main layout modes that the orthogonal layout algorithm supports depending on whether the edges should be routed completely orthogonally, or whether the original size of the nodes should be maintained. The modes are STRICT, FORCED_STRAIGHT_LINE, RELAXED, and can be specified via property layoutMode.
OrthogonalLayout is able to consider edge label data when arranging a graph. This means that the layout algorithm will determine the positions of the nodes and edges such that the edge labels do not overlap with the rest of the layout. Integrated edge labeling can be activated with the edgeLabelPlacement property.
OrthogonalLayoutEdgeDescriptor instances can be used for specifying individual information (e.g. distances) for each edge in the graph. The descriptors are bound to the graph via the layout data property edgeDescriptors. If there is no descriptor assigned to some edges, a default descriptor will be used. To set default descriptors, use defaultEdgeDescriptor.
OrthogonalLayout tries to optimize diverse objective functions such as bend minimization, number of edge crossings, edge length minimization or face maximization. Depending on the qualityTimeRatio and the specified time limit, all or only some of the optimization steps are executed.
For input graphs without group nodes, this layout algorithm is able to detect some specific substructures. If desired, it can handle and arrange them explicitly, making the structure easy to recognize. Supported substructures are trees, chains and cycles. See the corresponding style properties for details: treeSubstructureStyle, chainSubstructureStyle and cycleSubstructureStyle. For the detection of substructures, it is optionally possible to consider nodeTypes, such that only nodes of the same user-defined type can form a substructure.
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:
- PortPlacementStage: Assigns edges to ports. The property routeCorrectionPolicy is set to LOCAL_ORTHOGONAL.
- GroupHidingStage: Removes group nodes and their adjacent edges before layout processing, and reinserts them afterward. The property hidingEmptyGroupNodes is set to
falseand resetEdgePaths is set totrue. Note: This stage is disabled by default. - SubgraphLayoutStage: Filters a graph to include only specific nodes and edges from a subgraph while maintaining the positions of excluded elements. Note: This stage is disabled by default.
- ComponentLayout: Arranges graph components with customizable styles.
- GenericLabeling: Efficiently places node and edge labels. The property fillEmptyScope is set to
falseand stopDuration is set to ZERO. - OrientationStage: Changes the layout orientation in four possible directions, with or without mirroring on the x or y-axis. The property edgeLabelPlacement is set to IGNORE.
- SelfLoopRouter: Routes self-loops in a graph, allowing for either orthogonal or rounded routing styles. Note: This stage is disabled by default.
- ParallelEdgeRouter: Routes multiple edges between the same nodes in parallel. Note: This stage is disabled by default.
With these layoutStages the layout algorithm is configured well, so they usually don't need to be changed.
Default Values of Properties
| Name | Default | Description |
|---|---|---|
| alignDegreeOneNodes | false | Degree-one nodes with the same neighbor are not aligned with each other. |
| chainSubstructureStyle | OrthogonalLayoutChainSubstructureStyle.NONE | Chains are not handled explicitly. |
| cycleSubstructureStyle | OrthogonalLayoutCycleSubstructureStyle.NONE | Cycles are not handled explicitly. |
| edgeLabelPlacement | EdgeLabelPlacement.INTEGRATED | Edge labels are placed by the layout algorithm. |
| fromSketchMode | false | The initial coordinates of the nodes are not considered. |
| gridSpacing | 20 | |
| nodeLabelPlacement | NodeLabelPlacement.CONSIDER | Node labels are considered. |
| qualityTimeRatio | 0.6 | Quality is a bit more important than fast running time. |
| stopDuration | TimeSpan.MAX_VALUE | The layout algorithm runs unrestricted. |
| treeSubstructureStyle | OrthogonalLayoutTreeSubstructureStyle.NONE | Subtrees are not arranged in a special way. |
| uniformPortAssignment | false |
See Also
Developer's Guide
Members
Constructors
Creates a new OrthogonalLayout instance with default settings.
Parameters
Properties
Property Value
true if the degree-one nodes are aligned, false otherwiseDefault Value
Sample Graphs
falseProperty Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the given minimum size is less than
2
Default Value
See Also
Developer's Guide
Gets or sets the arrangement style for chain substructures.
A chain is a simple edge path where the degree of the nodes is less than or equal to 2.
Property chainSubstructureSize defines the minimum length a chain needs to have to be handled explicitly.
If there are user-defined nodeTypes, a chain substructure contains only nodes of the same type or only nodes without a type (i.e. null as type). This way, node types can be used to control which elements are allowed to form a substructure.
Property Value
Default Value
See Also
Developer's Guide
Gets or sets the ComponentLayout from the layoutStages of this instance.
Throws
- Exception ({ name: 'InvalidOperationError' })
- If there is no instance of the respective type in the layoutStages
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the given minimum size is less than
4
Default Value
See Also
Developer's Guide
Gets or sets the arrangement style for cycle substructures.
A cycle is a simple edge path where the first and last node are identical. The algorithm only considers cycles where at most one edge connects a cycle node with the rest of the graph (i.e. isolated cycles that are connected with one edge).
If there are user-defined nodeTypes, a cycle contains only nodes of the same type or only nodes without a type (i.e. null as type). This way, node types can be used to control which elements are allowed to form a substructure.
Property Value
Default Value
See Also
Developer's Guide
Gets or sets the OrthogonalLayoutEdgeDescriptor instance used for all those edges that do not have a specific descriptor assigned.
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the specified OrthogonalLayoutEdgeDescriptor is
null
Default Value
See Also
Developer's Guide
API
- edgeDescriptors
Gets or sets how the layout handles the position of edge labels.
Property Value
Default Value
Sample Graphs
See Also
Developer's Guide
Property Value
true if the existing drawing is used as a sketch, false otherwiseDefault Value
Sample Graphs
See Also
Developer's Guide
Each node will be placed on a grid point. Edges will be routed such that all segments but the first and last one lie on grid lines. (The first and last segments of an edge may or may not lie on grid lines.) Edges consisting of a single segment always lie on grid lines.
The grid spacing has to be greater than 0.
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the grid spacing is negative
Default Value
Sample Graphs
20.See Also
Developer's Guide
Gets or sets the layoutOrientation of the OrientationStage.
See Also
Developer's Guide
Gets or sets how the layout handles the position of node labels.
Property Value
Default Value
Sample Graphs
See Also
Developer's Guide
When enabled, the algorithm routes multi-edges (edges that connect the same pair of nodes) in parallel, i.e., these edges connect to the same side of the nodes and have the same or a similar path. Note that the path is not always exactly the same since the algorithm has to omit label-edge intersections if edgeLabelPlacement is set to INTEGRATED. If this setting is disabled, the edges are simply independent and might as well connect to different node sides and get very different paths.
A parallel routing is suitable for a lot of diagrams (especially larger ones) as it helps to better recognize multi-edge structures. However, there are scenarios where the routes of such edges might as well be independent. For small examples the structure can also be clear if the edges connect to other node sides, especially when they are in consecutive order around the node.
Property Value
true if parallel edges are routed in parallel, false otherwiseDefault Value
Sample Graphs
trueThe larger the ratio, the better the quality of the resulting layout but the longer it may take to perform the layout calculation.
The value needs to lie within [0,1].
Property Value
0.0 (low quality, fast) and 1.0 (high quality, slow)Throws
- Exception ({ name: 'ArgumentError' })
- if the specified ratio is outside the interval
[0,1]
Default Value
Gets or sets the preferred time limit.
Depending on the specified value and the size of the input graph, the layout algorithm may automatically disable some internal optimization steps that can improve the layout quality but also increase the runtime, especially for larger graphs. If the time limit is set to MAX_VALUE, the layout algorithm runs unrestricted.
Values have to be greater or equal to ZERO.
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the stop duration is negative
Default Value
See Also
Developer's Guide
Gets or sets the desired orientation for tree substructure layouts.
Property Value
Default Value
See Also
Developer's Guide
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the given minimum size is less than
3
Default Value
See Also
Developer's Guide
Gets or sets the arrangement style for tree substructures.
null as type). This way, node types can be used to control which elements are allowed to form a substructure.Property Value
Default Value
See Also
Developer's Guide
Property Value
true if the port assignment is uniform, false otherwiseDefault Value
Sample Graphs
trueSee Also
Developer's Guide
Methods
Calculates an orthogonal layout for the given graph.
Parameters
- graph: LayoutGraph
- the input graph
Implements
ILayoutAlgorithm.applyLayoutCalculates an orthogonal layout for the given graph.
Parameters
- graph: LayoutGraph
- the input graph
createLayoutData
(graph: LayoutGraph): OrthogonalLayoutData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel>Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the OrthogonalLayout.
createLayoutData
(graph: LayoutGraph): OrthogonalLayoutData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel>Parameters
- graph: LayoutGraph
- the graph that determines the generic type arguments of the created layout data
Return Value
- OrthogonalLayoutData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel>
- an instance of layout data that can be used to perform item-specific configurations for the given OrthogonalLayout.
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the OrthogonalLayout.
LayoutExecutor type is available at runtime.Parameters
- graph?: IGraph
- the graph that determines the generic type arguments of the created layout data
Return Value
- OrthogonalLayoutData<INode, IEdge, ILabel, ILabel>
- an instance of layout data that can be used to perform item-specific configurations for the given OrthogonalLayout.