This layout algorithm removes overlaps between nodes in a graph.
Remarks
Note: The usage of RemoveOverlapsStage instead of this class is recommended for most use cases involving the mere removal of overlaps. That stage offers a more powerful strategy to do the task.
Layout Style
The style of results often resembles the look of tiles which have been dropped onto each other, where tiles correspond to nodes of the graph. The reason is that overlapping nodes are moved in order to resolve the overlap. During this process, several nodes moving in the same direction may be stacked next to or above each other.
This algorithm does not route the edges of the input graph - edges might although be stretched due to the node movement.
Concept
Nodes overlapping with other nodes will be moved in horizontal or vertical direction in order to remove overlaps. The concept behind this removal step is based on a famous Russian arcade game.
Features
This layout stage can also be executed on its own, without specifying a core layout algorithm.
A minimum distance between nodes can be specified such that not only overlaps will be removed but nodes will keep this specified distance to other nodes. This distance can be defined separately for each node using a IDataProvider registered with key MINIMUM_DISTANCE_DP_KEY. The minimum distance can also be specified globally via minimumNodeDistance.
To specify that specific nodes should not be moved, they can be marked as fixed using a IDataProvider registered with key FIXED_NODE_DP_KEY.
Default Values of Properties
barycenterMode | false | The barycenter mode is disabled. |
horizontalOverlapCriterion | LESS_MOVEMENT
| |
minimumNodeDistance | 5 |
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.organic.ShuffleLayout
Constructors
Creates a new instance of ShuffleLayout with default settings.
Parameters
A map of options to pass to the method.
- coreLayout - ILayoutAlgorithm
The core layout algorithm. This option sets the coreLayout property on the created object.
- horizontalOverlapCriterion - HorizontalOverlapCriterion
The criterion for marking an overlap as horizontal. This option sets the horizontalOverlapCriterion property on the created object.
- minimumNodeDistance - number
The default minimum distance that has to be obeyed between any two nodes. This option sets the minimumNodeDistance property on the created object.
- simpleMode - boolean
Whether or not the simple, fast layout mode of this algorithm is active. This option sets the simpleMode property on the created object.
- barycenterMode - boolean
Whether or not the barycenter mode is used for node shuffling when removing overlaps. This option sets the barycenterMode property on the created object.
Properties
Gets or sets whether or not the barycenter mode is used for node shuffling when removing overlaps.
Remarks
If this mode is active, the overlap removal step will be executed two times for each direction, once with the normal node ordering and once with the reversed ordering. Finally, the barycenter between both results will be used for assigning the node coordinates.
Activating the barycenter mode allows more symmetric results for some graphs. However, the runtime might increase.
Default Value
false
.The barycenter mode is disabled.
Sample Graphs
Gets or sets the core layout algorithm.
Remarks
See Also
Implements
Gets or sets the criterion for marking an overlap as horizontal.
Remarks
Default Value
LESS_MOVEMENT.Throws
- Exception({ name: 'ArgumentError' })
- if the given criterion is unknown
Gets or sets the default minimum distance that has to be obeyed between any two nodes.
Remarks
This default distance will be considered for a node if the IDataProvider registered with the graph with key MINIMUM_DISTANCE_DP_KEY does not contain a valid, positive distance for that node. If there is no IDataProvider registered with the mentioned key, then this default distance will be applied to all nodes.
The minimum distance needs to be a non-negative value.
Default Value
5
.Throws
- Exception({ name: 'ArgumentError' })
- if the given distance is negative
See Also
Sample Graphs
Gets or sets whether or not the simple, fast layout mode of this algorithm is active.
Remarks
Enabling this mode, the overlap removal step will be executed using a simpler and less sophisticated approach. All overlaps will only be solved by moving nodes vertically. The algorithm will not try to figure out which direction might be better for overlap removal.
The runtime will improve, but results may be of lower quality when using this mode.
Default Value
false
.Sample Graphs
Methods
Performs the overlap removal (shuffle) algorithm on the given graph, after the core layout algorithm was applied to it.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Implements
Constants
A data provider key for marking nodes as fixed.
Remarks
Domain | YNode | |
Values | boolean | true if the node should be fixed, false otherwise. |
A data provider key for specifying a minimum distance for each node.
Remarks
The default minimum distance specified by minimumNodeDistance will be ignored for a node if the IDataProvider registered with this key contains a valid minimum distance for that node.
Minimum distance values need to be greater than 0
.
Domain | YNode | |
Values | number | the minimum distance to be kept to the node |