This ILayoutStage removes node overlaps and guarantees a certain minimum distance between nodes.
Remarks
Layout Style
This stage only removes overlaps between nodes of the input graph. To do so, overlapping nodes will be moved apart. Before removing the node overlaps, an optional coreLayout is applied.
Features
There are two strategies offered for removing overlaps:
- SHUFFLE: The fast and default policy. Results often look like a stretched version of the original graph.
- PRESERVE_RELATIVE_LOCATIONS: A more involved strategy which can generate higher quality results and tries to preserve the relative locations of neighboring elements as they are given in the input. This is especially suitable for undirected graph drawings with straight-line edges, as produced by organic layout approaches.
It is possible to define a minimum distance between nodes. This feature allows to not only remove overlaps but forces nodes to keep a specified distance to other nodes.
Default Values of Properties
horizontalOverlapCriterion | LESS_MOVEMENT
| |
overlapRemovalPolicy | SHUFFLE
| |
stopDuration | MAX_VALUE
|
Type Details
- yFiles module
- algorithms
Constructors
Creates a new RemoveOverlapsStage instance with default settings.
Parameters
A map of options to pass to the method.
- minimumNodeDistance - number
- The minimum distance to be kept between any two nodes of the graph. This option sets the minimumNodeDistance property on the created object.
- stopDuration - TimeSpan
- The duration that this layout stage is allowed to run before stopping gracefully. This option sets the stopDuration property on the created object.
- overlapRemovalPolicy - OverlapRemovalPolicy
- The node overlap removal policy. This option sets the overlapRemovalPolicy 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.
- enabled - boolean
- coreLayout - ILayoutAlgorithm
- The core ILayoutAlgorithm that is wrapped by this stage. This option sets the coreLayout property on the created object.
Properties
Gets or sets the core ILayoutAlgorithm that is wrapped by this stage.
Gets or sets a value that determines whether this stage should do anything but execute the coreLayout.
Remarks
By default, when constructed, stages should be enabled. Users may disable a stage's functionality by setting this property to false
.
Stages that can guarantee that the graph will not change can choose to not even execute the coreLayout when disabled.
Implements
Gets or sets the criterion for marking an overlap as horizontal.
Remarks
Default Value
LESS_MOVEMENT.Property Value
Gets or sets the minimum distance to be kept between any two nodes of the graph.
Remarks
Due to this distance not only nodes that overlap will be moved to resolve the overlap, but also nodes which are too close to each other with respect to this distance will be displaced.
The minimum node distance needs to be non-negative. The default value is 0
.
To define individual minimum distances, use the layout data property minimumNodeDistances.
Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the given minimum distance is negative
Sample Graphs
Gets or sets the node overlap removal policy.
Default Value
SHUFFLE.Property Value
Gets or sets the duration that this layout stage is allowed to run before stopping gracefully.
Remarks
This stop time does not include the time required for the coreLayout.
The duration needs to be non-negative.
Default Value
MAX_VALUE.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the specified duration has a negative value
Methods
Implementation of the ILayoutAlgorithm interface and main entry point for the layout calculation.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- The graph to apply the layout to.
Implements
Removes node overlaps and displaces nodes of the given graph such that they keep the specified minimum distance to each other.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
Implements
createLayoutData
(graph: LayoutGraph) : RemoveOverlapsStageData<LayoutNode,LayoutEdge,LayoutNodeLabel,LayoutEdgeLabel>Returns an instance of LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> that can be used to perform item-specific configurations for the RemoveOverlapsStage.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the graph that determines the generic type arguments of the created layout data
Returns
- ↪RemoveOverlapsStageData<LayoutNode,LayoutEdge,LayoutNodeLabel,LayoutEdgeLabel>
- an instance of layout data that can be used to perform item-specific configurations for the given RemoveOverlapsStage.
Returns an instance of LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> that can be used to perform item-specific configurations for the RemoveOverlapsStage.
Remarks
Parameters
A map of options to pass to the method.
- graph - IGraph
- the graph that determines the generic type arguments of the created layout data
Returns
- ↪RemoveOverlapsStageData<INode,IEdge,ILabel,ILabel>
- an instance of layout data that can be used to perform item-specific configurations for the given RemoveOverlapsStage.
LayoutExecutor
type is available at runtime.Constants
A data key for marking nodes as fixed.
Remarks
Assign true
to a node if the node should be fixed, or false
otherwise.
A node marked as fixed will not be moved by this algorithm but stay at its current position.
See Also
A data key for specifying an individual minimum distance for each node.
Remarks
The default minimum distance specified by property minimumNodeDistance will be ignored for a node if the IMapper<K,V> registered with this key contains a valid minimum distance for that node.
Minimum distance values need to be greater than 0
.