This class represents a partial layout algorithm which changes the coordinates for a given set of graph elements (called partial elements) only.
Remarks
The location and size of the remaining elements (called fixed elements) is not allowed to be changed.
Layout Style
This partial layout algorithm offers a kind of generic partial layout support for other existing layout algorithms. Hence, its layout style heavily depends on the selected core layout algorithm as well as the specified edge router or edge routing strategy.
The partial layout is suitable for applications where users may incrementally add new elements to an existing drawing. The added elements should be arranged so that they fit best possible into the given diagram without making any changes to the already existing layout. Hence, the so-called mental map of the existing drawing is preserved.
Features
Similar to the layout style, the supported feature set mainly depends on the features supported by the specified core layout algorithm as well as the specified edge router or edge routing strategy. The internal step that places the components can handle group nodes and is able to consider minimum distance constraints.
Furthermore, the algorithm tries to place a subgraph component within the associated cell of the PartitionGrid. For this feature to work properly it is required that the values of the properties originalPosition, originalPosition originalWidth and originalHeight are correctly specified. Note that the algorithm does not guarantee that the calculated subgraph layout fits into the grid cell.
Concept
The layout algorithm tries to place the partial elements such that the resulting drawing (including the fixed elements) has a good quality with respect to common graph drawing aesthetics.
The layout algorithm handles each selected graph element as partial element. For this, it looks up the IDataProvider keys AFFECTED_NODES_DP_KEY and AFFECTED_EDGES_DP_KEY. Partial node elements can be assigned to the so-called subgraph components. During the layout process each subgraph induced by the nodes of a component is first laid out using the specified core layout algorithm. Then, the different components are placed one-by-one onto the drawing area such that the number of overlaps among graph elements is small. The user can specify different objectives for finding 'good' positions for subgraph components (see subgraphPlacement), e.g., BARYCENTER specifies that the component should be placed close to the barycenter of its graph neighbors and FROM_SKETCH specifies that the component should be placed close to its original position.
Method componentAssignmentStrategy allows to specify the strategy that assigns partial nodes to subgraph components. Possible values are CLUSTERING, CONNECTED, SINGLE and CUSTOMIZED. The last value allows to use a customized component assignment. Note that nodes of a component cannot be assigned to different group nodes.
Furthermore, the user can specify the edge routing strategy (see edgeRoutingStrategy) that is used for routing partial edges and edges between different subgraph components (so-called inter-edges). Possible values are ORGANIC, ORTHOGONAL, STRAIGHTLINE, OCTILINEAR and AUTOMATIC.
Default Values of Properties
allowMirroring | false | Mirroring is disabled. |
allowMovingFixedElements | false | The algorithm doesn't move fixed elements. |
componentAssignmentStrategy | SINGLE
| Each partial node is assigned to a separate subgraph component. |
componentCompaction | true | Subgraph component may be placed within another subgraph component. |
considerNodeAlignment | false | Nodes are not aligned. |
edgeRouter | StraightLineEdgeRouter
| |
edgeRoutingStrategy | STRAIGHTLINE
| |
layoutOrientation | NONE
| The layout orientation is completely ignored. |
maximumDuration | <code>0x7FFFFFFF</code> | The time is not limited. |
minimumNodeDistance | 10 | |
optimizeOrientation | true | This postprocessing step is enabled. |
resizeFixedGroups | false | Fixed group nodes may not be resized. |
routeInterEdgesImmediately | false | Edges are not routed immediately. |
subgraphPlacement | BARYCENTER
| Each subgraph component is placed close to the barycenter of its graph neighbors. |
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.partial.PartialLayout
See Also
Constructors
Creates a new instance of PartialLayout which uses the specified ILayoutAlgorithm instance as the core layout algorithm.
Remarks
Parameters
A map of options to pass to the method.
- coreLayout - ILayoutAlgorithm
- the layout algorithm that is applied to the subgraph components
- allowMovingFixedElements - boolean
Whether or not the algorithm may move fixed elements. This option sets the allowMovingFixedElements property on the created object.
- maximumDuration - number
The preferred time limit (in milliseconds) for the layout algorithm. This option sets the maximumDuration property on the created object.
- routeInterEdgesImmediately - boolean
Whether or not edges between different subgraph components should be routed immediately. This option sets the routeInterEdgesImmediately property on the created object.
- componentCompaction - boolean
Whether or not a subgraph component may be placed within another subgraph component. This option sets the componentCompaction property on the created object.
- resizeFixedGroups - boolean
Whether or not fixed (non-partial) group nodes may be resized. This option sets the resizeFixedGroups property on the created object.
- subgraphPlacement - SubgraphPlacement
The objective used for finding 'good' positions for subgraph components. This option sets the subgraphPlacement property on the created object.
- minimumNodeDistance - number
The minimum distance between two adjacent nodes. This option sets the minimumNodeDistance property on the created object.
- considerNodeAlignment - boolean
Whether or not partial nodes should be aligned. This option sets the considerNodeAlignment property on the created object.
- componentAssignmentStrategy - ComponentAssignmentStrategy
The strategy that assigns partial nodes to subgraph components. This option sets the componentAssignmentStrategy property on the created object.
- optimizeOrientation - boolean
Whether or not a postprocessing step should be applied to reduce the number of directed edges that do not comply with the specified layout orientation. This option sets the optimizeOrientation property on the created object.
- edgeRouter - ILayoutAlgorithm
The custom edge router instance that is used for partial edges and edges between different subgraph components (so-called inter-edges). This option sets the edgeRouter property on the created object.
- edgeRoutingStrategy - PartialLayoutEdgeRoutingStrategy
The routing strategy that is used for partial edges and inter-edges. This option sets the edgeRoutingStrategy property on the created object.
- layoutOrientation - PartialLayoutOrientation
The layout orientation that is considered during the placement of partial elements. This option sets the layoutOrientation property on the created object.
- allowMirroring - boolean
Whether or not subgraph components are mirrored to improve the layout quality. This option sets the allowMirroring property on the created object.
See Also
Properties
Gets or sets whether or not subgraph components are mirrored to improve the layout quality.
Remarks
Default Value
false
.Mirroring is disabled.
Sample Graphs
Gets or sets whether or not the algorithm may move fixed elements.
Remarks
Default Value
false
.The algorithm doesn't move fixed elements.
Gets or sets the strategy that assigns partial nodes to subgraph components.
Remarks
- SINGLE: each partial node is a separate subgraph component. The specified core layout doesn't have any effect because it is applied to each single node separately.
- CONNECTED: components are defined by the connected components of the graph induced by the partial elements.
- CLUSTERING: components are defined by edge betweenness clustering.
- CUSTOMIZED: components are user-defined. Two partial nodes are considered to be in the same component if the IDataProvider associated with key COMPONENT_ID_DP_KEY returns the same object for both of them.
Default Value
Throws
- Exception({ name: 'ArgumentError' })
- if the specified strategy does not match one of the predefined strategies
See Also
Sample Graphs
Gets or sets whether or not a subgraph component may be placed within another subgraph component.
Remarks
Default Value
true
.Subgraph component may be placed within another subgraph component.
Gets or sets whether or not partial nodes should be aligned.
Remarks
Default Value
false
.Nodes are not aligned.
See Also
Sample Graphs
Gets or sets the ILayoutAlgorithm instance that is applied to each subgraph component.
Remarks
See Also
Sample Graphs
Overrides
Gets or sets the custom edge router instance that is used for partial edges and edges between different subgraph components (so-called inter-edges).
Default Value
StraightLineEdgeRouter.See Also
Gets or sets the routing strategy that is used for partial edges and inter-edges.
Remarks
- STRAIGHTLINE produces straight-line edge routes.
- ORTHOGONAL produces orthogonal edge routes.
- OCTILINEAR produces octilinear edge routes.
- ORGANIC produces organic edge routes.
- AUTOMATIC automatically chooses a suitable strategy for the partial edges inter-edges, based on the existing routes of the fixed edges.
Default Value
STRAIGHTLINE.Throws
- Exception({ name: 'ArgumentError' })
- if the specified strategy does not match one of the predefined routing strategies
See Also
Sample Graphs
Gets or sets the layout orientation that is considered during the placement of partial elements.
Remarks
v
is placed before v
and each successor after v
with respect to the layout orientation.- NONE: the layout orientation is completely ignored.
- AUTO_DETECT: the layout orientation is automatically detected. The algorithm analyzes the flow direction of fixed edges in the current drawing. If there is no common flow direction, the results are the same as for NONE. Otherwise, the layout orientation is one of the four main orientation.
- TOP_TO_BOTTOM: the algorithm tries to place partial nodes (subgraph components) such that each predecessor of a node
v
is placed abovev
and each successor belowv
. - BOTTOM_TO_TOP: the algorithm tries to place partial nodes (subgraph components) such that each predecessor of a node
v
is placed belowv
and each successor abovev
. - LEFT_TO_RIGHT: the algorithm tries to place partial nodes (subgraph components) such that each predecessor of a node
v
is placed to the left ofv
and each successor to the right ofv
. - RIGHT_TO_LEFT: the algorithm tries to place partial nodes (subgraph components) such that each predecessor of a node
v
is placed to the right ofv
and each successor to the left ofv
.
Default Value
Throws
- Exception({ name: 'ArgumentError' })
- if the specified orientation does not match one of the predefined orientations
See Also
Sample Graphs
Gets or sets the preferred time limit (in milliseconds) for the layout algorithm.
Remarks
0
. If the value is 0x7FFFFFFF
, the time is not limited.Default Value
<code>0x7FFFFFFF</code>
.The time is not limited.
Throws
- Exception({ name: 'ArgumentError' })
- if the maximum duration is negative
See Also
Gets or sets the minimum distance between two adjacent nodes.
Remarks
Default Value
10
.Throws
- Exception({ name: 'ArgumentError' })
- if the distance is negative
See Also
Sample Graphs
Gets or sets whether or not a postprocessing step should be applied to reduce the number of directed edges that do not comply with the specified layout orientation.
Default Value
true
.This postprocessing step is enabled.
See Also
Gets or sets whether or not fixed (non-partial) group nodes may be resized.
Remarks
Default Value
false
.Fixed group nodes may not be resized.
Gets or sets whether or not edges between different subgraph components should be routed immediately.
Remarks
Default Value
false
.Edges are not routed immediately.
See Also
Gets or sets the objective used for finding 'good' positions for subgraph components.
Default Value
BARYCENTER.Each subgraph component is placed close to the barycenter of its graph neighbors.
Throws
- Exception({ name: 'ArgumentError' })
- if the specified strategy does not match one of the predefined positioning strategies
See Also
Methods
This method calculates the partial layout.
Remarks
- routeEdgesBetweenFixedElements
- layoutSubgraph for each subgraph component
- placeSubgraphs
- routeInterEdges
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
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
See Also
Defined in
This method is called each time when edges are routed with an edge router.
Remarks
Subclasses may modify the configuration of the given edge router instance.
The type of the given instance depends on the edge routing strategy, i.e., if the routing strategy is set to OCTILINEAR or ORTHOGONAL it's an instance of EdgeRouter, if the routing strategy is set to ORGANIC it's an instance of OrganicEdgeRouter, and, if the routing strategy is set to STRAIGHTLINE it's an instance of a private StraightLineEdgeRouter. If the edge routing strategy is set to AUTOMATIC, the layout algorithm chooses one of the above strategies that best fits the routing style of the fixed edges.
Parameters
A map of options to pass to the method.
- edgeRouter - ILayoutAlgorithm
- the instance used for routing the edges
See Also
This method is called during the layout process and calculates the layout for the given subgraph component using the specified core layout algorithm.
Remarks
It is called once for each subgraph component.
Subclasses may implement a custom layout strategy or add some additional data.
Parameters
A map of options to pass to the method.
- subGraph - LayoutGraph
- the subgraph component
This method is called during the layout process and places the subgraph components one-by-one onto the drawing area.
Remarks
Therefore, it considers the specified objective for finding a suitable position.
Subclasses may implement a custom placement strategy or add some additional data. However, they must not modify the given subgraph component lists.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- subgraphComponents - YNodeList[]
- each entry contains a YNodeList that induces a subgraph component
This method is called during the layout process and routes all partial edges that connect two fixed elements.
Remarks
It either uses a custom edge router or an internal edge router that produces routes according to the specified routing strategy.
Subclasses may implement a custom routing strategy or add some additional data.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the subgraph of the input graph induced by the fixed nodes
- partialEdges - EdgeList
- the list of partial edges to be routed
This method is called during the layout process and routes all inter-edges.
Remarks
Inter-edges are edges between different subgraph components including edges between fixed and partial elements. For the routing, this method uses the edge router instance set with method edgeRouter. If no edge router was specified by the user, it uses an internal edge router with routing strategy edgeRoutingStrategy.
Subclasses may implement a custom routing strategy or add some additional data.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the relevant subgraph
- interEdges - EdgeList
- the list of inter-edges to be routed
Constants
A data provider key for marking partial edges.
Domain | Edge | |
Values | boolean | all edges associated with value true are considered to be partial, those associated with value false to be fixed |
See Also
A data provider key for marking partial nodes.
Domain | YNode | |
Values | boolean | all nodes associated with value true are considered to be partial, those associated with value false to be fixed |
See Also
A data provider key for defining custom subgraph components.
Domain | YNode | the partial nodes of the input graph |
Values | Object | all nodes associated with the same object are assigned to the same subgraph component |
See Also
Sample Graphs
A data provider key for specifying the edges that should be considered to be directed.
Remarks
Domain | Edge | |
Values | boolean | all edges associated with value true are considered to be directed, edges associated with value false undirected |
See Also
A data provider key for obtaining the edges that should be routed by the edge router.
Domain | Edge | |
Values | boolean | all edges associated with value true have to be routed by the |