This layout algorithm arranges a graph in a compact, orthogonal fashion.
Remarks
Layout Style
This layout algorithm is a variant of OrthogonalLayout that tries to arrange nodes in a more compact way. It allows to specify a desired aspect ratio for the bounds of the calculated layout. Nodes of a given graph are arranged such that each edge is drawn as an alternating sequence of horizontal and vertical segments.
CompactOrthogonalLayout is well suited for small and medium-sized sparse graphs and produces compact drawings with no overlapping nodes, few crossings and few bends. It is also especially suitable for printing the diagram on a paper of predefined size. As a disadvantage, this algorithm will usually produce less elegant edge routes than the ones of OrthogonalLayout.
Application domains of orthogonal drawings are software engineering, project management, function call graphs and object-oriented class diagrams.
1.0
Concept
This algorithm is implemented as a PartitionLayout and applies the following steps:
- Divides the graph into smaller partitions using the partition finder instance created by createEdgeBetweennessPartitionFinder.
- Arranges the nodes of each graph partition using OrthogonalLayout.
- Arranges the partitions themselves in a compact manner using the partition placer instance created by createComponentPartitionPlacer.
- Routes the edges between partitions (inter-edges) using the router instance created by createChannelInterEdgeRouter.
Each of these steps can be individually configured and/or replaced. To do so, use methods partitionFinder, coreLayout, partitionPlacer and interEdgeRouter, respectively.
Features
The aspect ratio of the resulting layout bounds, i.e., the ratio of width/height of the layout, can be configured using aspectRatio. CompactOrthogonalLayout tries to reach this preferred value. However, depending on the actual graph structure, this may not always be possible.
Octilinear routing of edges can be supported by appending PolylineLayoutStage.
Default Values of Properties
aspectRatio | 1 | |
coreLayout | OrthogonalLayout
| |
gridSpacing | 20 | |
interEdgeRouter | createChannelInterEdgeRouter
| |
partitionFinder | createEdgeBetweennessPartitionFinder
| |
partitionPlacer | createComponentPartitionPlacer
|
Type Details
- yfiles module
- layout-orthogonal-compact
- yfiles-umd modules
- layout-orthogonal-compact, layout
- Legacy UMD name
- yfiles.orthogonal.CompactOrthogonalLayout
See Also
Constructors
Creates a new CompactOrthogonalLayout instance with default settings.
Parameters
A map of options to pass to the method.
- gridSpacing - number
The equidistant spacing between the horizontal and vertical grid lines. This option sets the gridSpacing property on the created object.
- aspectRatio - number
The desired aspect ratio (that is the quotient width/height) of the resulting layout bounds. This option sets the aspectRatio property on the created object.
- partitionFinder - IPartitionFinder
The IPartitionFinder instance that is responsible for partitioning the input graph. This option sets the partitionFinder property on the created object.
- partitionPlacer - IPartitionPlacer
The IPartitionPlacer instance that is responsible for arranging the graph partitions. This option sets the partitionPlacer property on the created object.
- interEdgeRouter - IPartitionInterEdgeRouter
The IPartitionInterEdgeRouter instance that is responsible for inter-edge routing. This option sets the interEdgeRouter property on the created object.
- coreLayout - ILayoutAlgorithm
The core layout algorithm that is wrapped by this stage. This option sets the coreLayout property on the created object.
Properties
Gets or sets the desired aspect ratio (that is the quotient width/height) of the resulting layout bounds.
Remarks
0
.Default Value
1
.Throws
- Exception({ name: 'ArgumentError' })
- if the given aspect ratio is less than or equal to zero
See Also
Sample Graphs
Gets or sets the core layout algorithm that is wrapped by this stage.
Default Value(Overrides the default value defined in ILayoutStage)
OrthogonalLayout.See Also
Implements
Gets or sets the equidistant spacing between the horizontal and vertical grid lines.
Remarks
Each node will be placed on a grid point. Edges will be routed such that their segments lie on grid lines, if the endpoints of the edges allow to place the ports accordingly.
The grid spacing has to be greater than 0
.
Default Value
20
.Throws
- Exception({ name: 'ArgumentError' })
- if the grid spacing is negative or zero
See Also
Sample Graphs
Gets or sets the IPartitionInterEdgeRouter instance that is responsible for inter-edge routing.
Default Value(Overrides the default value defined in PartitionLayout)
createChannelInterEdgeRouter.Defined in
Gets or sets the IPartitionFinder instance that is responsible for partitioning the input graph.
Default Value(Overrides the default value defined in PartitionLayout)
createEdgeBetweennessPartitionFinder.Defined in
Gets or sets the IPartitionPlacer instance that is responsible for arranging the graph partitions.
Default Value(Overrides the default value defined in PartitionLayout)
createComponentPartitionPlacer.Defined in
Methods
Arranges and places independent partitions in the graph.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
Throws
- Exception({ name: 'InvalidOperationError' })
- if the partition finder is
null
See Also
Implements
Invokes the layout process of the core layout algorithm.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph