C

RemoveOverlapsStage

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.

A graph containing overlaps (left) and the result after the overlap removal

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

NameDefault
coreLayoutnull
horizontalOverlapCriterionHorizontalOverlapCriterion.LESS_MOVEMENT
overlapRemovalPolicyOverlapRemovalPolicy.SHUFFLE
stopDurationTimeSpan.MAX_VALUE

See Also

Developer's Guide

Members

Show:

Constructors

Creates a new RemoveOverlapsStage instance with default settings.

Parameters

Properties

Gets or sets the core ILayoutAlgorithm that is wrapped by this stage.
final

Property Value

the core layout routine

Default Value

The default value is: null
Gets or sets a value that determines whether this stage should do anything but execute the coreLayout.

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.

final
Gets or sets the criterion for marking an overlap as horizontal.
When using policy SHUFFLE, this criterion influences how overlaps will be resolved. If an overlap is considered horizontal, it will preferably be solved by moving nodes horizontally, else vertically.
This criterion will only have an effect if using policy SHUFFLE as overlapRemovalPolicy.
conversionfinal

Property Value

one of the predefined horizontal overlap criteria

Default Value

Gets or sets the minimum distance to be kept between any two nodes of the graph.

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.

final

Property Value

the non-negative minimum node distance

Throws

Exception ({ name: 'ArgumentError' })
if the given minimum distance is negative

Sample Graphs

ShownSetting: Minimum distance 0
Gets or sets the node overlap removal policy.
conversionfinal

Property Value

one of the predefined overlap removal policies

Default Value

The default value is: OverlapRemovalPolicy.SHUFFLE
Gets or sets the duration that this layout stage is allowed to run before stopping gracefully.

This stop time does not include the time required for the coreLayout.

The duration needs to be non-negative.

Restricting the stop duration may result in a worse layout quality, i.e., there could still be some node overlaps. Furthermore, the actual runtime may exceed the stop duration since the algorithm still has to find a valid result.
conversionfinal

Property Value

the non-negative stop duration

Throws

Exception ({ name: 'ArgumentError' })
if the specified duration has a negative value

Default Value

The default value is: TimeSpan.MAX_VALUE

Methods

Implementation of the ILayoutAlgorithm interface and main entry point for the layout calculation.
This implementation checks the enabled state and when it's not enabled, will delegate to the coreLayout, directly. When the stage is enabled, all the work will be delegated to applyLayoutImpl, instead.
final

Parameters

graph: LayoutGraph
The graph to apply the layout to.
Removes node overlaps and displaces nodes of the given graph such that they keep the specified minimum distance to each other.
If a coreLayout is specified, it will be executed first.
The given graph will not be copied during the layout process and the layout will be immediately applied to the given graph.
protected

Parameters

graph: LayoutGraph
the input graph
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the RemoveOverlapsStage.
The generic type arguments of the created layout data are compatible with instances of LayoutGraph, but the layout data is not bound to a specific graph instance. Therefore, the created layout data still has to be passed as an argument of applyLayout in order to be applied.

Parameters

graph: LayoutGraph
the graph that determines the generic type arguments of the created layout data

Return Value

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.
The generic type arguments of the created layout data are compatible with instances of IGraph, but the layout data is not bound to a specific graph instance. Therefore, the created layout data still has to be passed as an argument of applyLayout in order to be applied.
This method is not available unless the module view-layout-bridge is loaded. Either load the module 'view-layout-bridge' explicitly or ensure that the LayoutExecutor type is available at runtime.

Parameters

graph?: IGraph
the graph that determines the generic type arguments of the created layout data

Return Value

RemoveOverlapsStageData<INode, IEdge, ILabel, ILabel>
an instance of layout data that can be used to perform item-specific configurations for the given RemoveOverlapsStage.

Constants

All constants are filtered. Go to Filters.