C

InteractiveOrganicLayout

This algorithm arranges graphs in an organic fashion and offers special functionality to interact with the graph while the algorithm is running.
Inheritance Hierarchy

Remarks

Besides the organic graph arrangement, this algorithm enables to immediately visualize changes made to a graph. Changes can be read back and the layout will be locally updated. That way, live interactions with an adapting graph layout are possible. Another advantage is that it is not necessary to compute a completely new layout if only small changes were made.

Layout Style

This algorithm supports the organic layout style which is characterized by a natural distribution of nodes. It is well suited to exhibit clusters and symmetric properties of a graph. Nodes are placed in a space-saving manner and distances between neighbors are highly uniform. Edges maintain uniform lengths too and are routed with straight-line segments without bends.

Organic diagrams are well suited for visualizing relations in large networks, for example, in bioinformatics, enterprise networking, social networks visualization, mesh visualization or system management.

Organic layout obtained using this algorithm

Concept

The internal basis for computing actual layouts is a force-directed approach placing the nodes of the input graph. The graph is modeled as a physical system with appropriate forces acting on it. Nodes are considered as electrically charged particles with mutually repulsive forces. Edges are modeled as forces that attract adjacent nodes. A good diagram is obtained from an equilibrium state of the system, i.e., the nodes are rearranged based on the physical forces until the system reaches a (local) minimum of the sum of the forces.

Importantly, changes will not be automatically applied to the input graph. To commit updates, it is required that a InteractiveOrganicNodeHandle for each node is provided in a mapper registered with key NODE_HANDLE_DATA_KEY. The algorithm will then write positions into the handle instance, which must then be manually transferred to the actually displayed graph (e.g. as part of an animation that transfers positions regularly).

Features

Several update methods on the InteractiveOrganicNodeHandle allow to indicate lightweight changes on the graph, for example, setCenter for node location updates. These updates will be scheduled and executed at a specific point within the life-cycle of the layout algorithm. They are ideally suited for usage in interactive scenarios, where users, for example, change node positions in the displayed graph via mouse-dragging.

Usage Hints

Start the algorithm using startLayout. Furthermore, it is strongly recommended to start it by passing a copy of the original graph as argument to the mentioned method.

Default Values of Properties

NameDefaultDescription
compactnessFactor0.4
defaultPreferredEdgeLength50
preferredNodeDistance50
qualityTimeRatio1
shapeConstraintShapeConstraint.NONE
No area restriction is imposed.

See Also

Developer's Guide

Members

No filters for this type

Constructors

Creates a new instance of the InteractiveOrganicLayout with default settings.

Parameters

Properties

Gets or sets the compactness factor for the layout algorithm.

Smaller values result in less compact drawings, greater values result in more compact drawings.

The compactness value needs to lie in [0,1].

If the graph consists of multiple components, using values less than 0.4 may lead to components drifting away from each other.
final

Property Value

the compactness value in [0,1]

Throws

Exception ({ name: 'ArgumentError' })
if the specified value is outside the interval [0,1]

Default Value

The default value is: 0.4

Sample Graphs

ShownSetting: Compactness is set to 0
Gets or sets the default preferred edge length.

This default preferred edge length is used when there is no specific preferred edge length defined for an edge via layout data property preferredEdgeLengths,

This length does not define the actual absolute length of edges, but the layout algorithm considers the specified preference where possible.

The preferred edge length needs to be non-negative.

Changes to this property are not considered while the layout process is still active. The preferred edge length specified here will only be considered when first starting the layout algorithm. Use preferredEdgeLength instead to schedule updates.
final

Property Value

the preferred edge length

Throws

Exception ({ name: 'ArgumentError' })
if the specified edge length is negative

Default Value

The default value is: 50

Sample Graphs

ShownSetting: Preferred edge length 40

See Also

Developer's Guide
API
preferredEdgeLength
Gets the time when the last wake-up, that is, call to wakeUp occurred.
readonlyfinal

Property Value

the time when the last call to wakeUp occurred
Gets or sets the preferred distance between nodes.
The minimum node distance needs to be non-negative.
It is not encouraged to change the node distance while the algorithm is running. Unlike other update methods, no update scheduling is implemented for this setting, so that synchronization problems may occur.
final

Property Value

the non-negative preferred distance between nodes

Throws

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

Default Value

The default value is: 50

Sample Graphs

ShownSetting: Preferred node distance 40

See Also

Developer's Guide
Gets or sets the ratio of layout quality versus running time.

The larger the ratio, the better the quality of the resulting layout but the longer it may take to perform the layout calculation.

The value needs to lie within [0,1].

final

Property Value

a value between 0.0 (low quality, fast) and 1.0 (high quality, slow)

Throws

Exception ({ name: 'ArgumentError' })
if the specified ratio is outside the interval [0,1]

Default Value

The default value is: 1

See Also

Developer's Guide
Gets whether or not this layout algorithm is currently running.
The algorithm is running if the layout process is still active, the algorithm has not stopped yet and is not sleeping.
readonlyfinal

Property Value

true if this algorithm is currently running, false otherwise

See Also

Developer's Guide
Gets or sets an shapeConstraint which restricts the area for the layout result of this algorithm.
final

Property Value

the shapeConstraint instance for restricting the area of the layout

Throws

Exception ({ name: 'ArgumentError' })
if the given restriction is null

Default Value

The default value is: ShapeConstraint.NONE
No area restriction is imposed.

Sample Graphs

ShownSetting: No restriction

See Also

Developer's Guide
API
ShapeConstraint
Gets whether or not this layout algorithm is currently sleeping.
Sleeping indicates that the algorithm has not stopped yet but is waiting (i.e. doing nothing). It can be notified to continue its work using wakeUp.
The algorithm may start sleeping if the layout has reached a stable state or if the stopDuration was exceeded.
readonlyfinal

Property Value

true if this algorithm is currently sleeping, false otherwise

See Also

Developer's Guide
API
wakeUp
Gets or sets the preferred stop duration that this algorithm is allowed to run.
The duration needs to be non-negative.
If the stop duration is exceeded, the algorithm will start to sleep.
conversionfinal

Property Value

the preferred stop duration

Throws

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

Default Value

The default value is: TimeSpan.MAX_VALUE
No time restriction is imposed.

See Also

Developer's Guide
Gets whether or not this layout algorithm has stopped.
If the algorithm has stopped, it terminated all its layout calculations. It is not running anymore and cannot be restarted/continued by calling wakeUp.
readonlyfinal

Property Value

true if the layout algorithm has stopped, false otherwise

See Also

Developer's Guide

Methods

Starts the layout calculation, continuing from where it has stopped before and allowing a certain maximum duration.
Throws an AlgorithmAbortedError if this method is called before the layout has been started startLayout.
final

Parameters

duration: TimeSpan
the duration the layout calculation is allowed to run

See Also

Developer's Guide
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the InteractiveOrganicLayout.
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

InteractiveOrganicLayoutData
An instance of layout data that can be used to perform item-specific configurations for the given GenericLabeling.
Starts the layout calculation for the given period of time.
Call continueLayout to start the layout from where it has stopped before, whenever the layout should be recalculated. Call stopLayout to terminate the layout algorithm. To actually transfer the changes, InteractiveOrganicNodeHandles should be registered with key NODE_HANDLE_DATA_KEY and their position information (which is written by the algorithm) must be transferred to the actually displayed graph.
final

Parameters

graph: LayoutGraph
the input graph
duration: TimeSpan
the duration the layout calculation is allowed to run

See Also

Developer's Guide
Stops the layout algorithm.
After calling this method, the algorithm cannot be started again and a new InteractiveOrganicLayout instance is required.
final

See Also

Developer's Guide
API
stopped
Wakes up the algorithm with the effect that it will restart/continue the layout calculation.
This method is useful if the algorithm is sleeping but should be notified of changes (e.g. due to user interaction).
It may be convenient to call this method after scheduling changes via properties/methods on the node/edge handle instances (e.g. setCenter or stress).
If the algorithm already terminated (i.e. stopped), it cannot be awakened again.
final

See Also

Developer's Guide
API
sleeping

Constants

A data key for specifying the InteractiveOrganicEdgeHandle instances that provide more information as input and updated information about edges after the layout stopped.
Registering handle instances for nodes is important for interactive scenarios where the layout algorithm is stopped and resumed later.
static

See Also

API
InteractiveOrganicEdgeHandle
A data key for specifying the InteractiveOrganicNodeHandle instances that provide more information as input and information about updated positions of nodes after the layout stopped.
Registering handle instances for nodes is important for interactive scenarios where the layout algorithm is stopped and resumed later.
static

See Also

API
InteractiveOrganicNodeHandle