This algorithm arranges graphs in an organic fashion and offers special functionality to interact with the graph while the algorithm is running.
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.
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
compactnessFactor | 0.4 | |
defaultPreferredEdgeLength | 50 | |
preferredNodeDistance | 50 | |
qualityTimeRatio | 1 | |
shapeConstraint | NONE
| No area restriction is imposed. |
Type Details
- yFiles module
- algorithms
See Also
Constructors
Creates a new instance of the InteractiveOrganicLayout with default settings.
Parameters
A map of options to pass to the method.
- compactnessFactor - number
- The compactness factor for the layout algorithm. This option sets the compactnessFactor property on the created object.
- defaultPreferredEdgeLength - number
- The default preferred edge length. This option sets the defaultPreferredEdgeLength property on the created object.
- preferredNodeDistance - number
- The preferred distance between nodes. This option sets the preferredNodeDistance property on the created object.
- stopDuration - TimeSpan
- The preferred stop duration that this algorithm is allowed to run. This option sets the stopDuration property on the created object.
- qualityTimeRatio - number
- The ratio of layout quality versus running time. This option sets the qualityTimeRatio property on the created object.
- shapeConstraint - ShapeConstraint
- An shapeConstraint which restricts the area for the layout result of this algorithm. This option sets the shapeConstraint property on the created object.
Properties
Gets or sets the compactness factor for the layout algorithm.
Remarks
Smaller values result in less compact drawings, greater values result in more compact drawings.
The compactness value needs to lie in [0,1]
.
Default Value
0.4
.Property Value
[0,1]
Throws
- Exception({ name: 'ArgumentError' })
- if the specified value is outside the interval
[0,1]
Sample Graphs
0.4
may lead to components drifting away from each other.Gets or sets the default preferred edge length.
Remarks
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.
Default Value
50
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the specified edge length is negative
See Also
Sample Graphs
Gets or sets the preferred distance between nodes.
Remarks
Default Value
50
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the specified minimum node distance is negative
See Also
Sample Graphs
Gets or sets the ratio of layout quality versus running time.
Remarks
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]
.
Default Value
1
.Property Value
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]
See Also
Gets or sets an shapeConstraint which restricts the area for the layout result of this algorithm.
Default Value
Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the given restriction is
null
See Also
Sample Graphs
Gets whether or not this layout algorithm is currently sleeping.
Remarks
Property Value
true
if this algorithm is currently sleeping, false
otherwiseSee Also
Gets or sets the preferred stop duration that this algorithm is allowed to run.
Methods
Starts the layout calculation, continuing from where it has stopped before and allowing a certain maximum duration.
Remarks
Parameters
A map of options to pass to the method.
- duration - TimeSpan
- the duration the layout calculation is allowed to run
See Also
Returns an instance of LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> that can be used to perform item-specific configurations for the InteractiveOrganicLayout.
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
- ↪InteractiveOrganicLayoutData
- An instance of layout data that can be used to perform item-specific configurations for the given GenericLabeling.
LayoutExecutor
type is available at runtime.Starts the layout calculation for the given period of time.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- duration - TimeSpan
- the duration the layout calculation is allowed to run
See Also
Stops the layout algorithm.
See Also
Wakes up the algorithm with the effect that it will restart/continue the layout calculation.
Remarks
See Also
Constants
A data key for specifying the InteractiveOrganicEdgeHandle instances that provide more information as input and updated information about edges after the layout stopped.
Remarks
See Also
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.