- I
Remarks
Layout Style
The organic layout style is characterized by a natural distribution of nodes that exhibits clusters and symmetric properties of the graph. Nodes are placed space-saving, close to their adjacent nodes. Edges maintain uniform lengths and are routed with straight-line segments without bends.
Organic diagrams are commonly used for visualizing relations in large networks for example in bioinformatics, enterprise networking, visualizing social networks, mesh visualization or system management.
Concept
OrganicLayout uses a force-directed approach to place the nodes of the input graph. According to this approach, 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 springs 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.
Features
Quality-Time-Ratio
The ratio between the layout quality and the running time is conveniently adjustable.
Layout Grid
This layout algorithm is able to consider a LayoutGrid structure. However, for common nodes (i.e. non-group nodes) it only considers single layout grid cells. Furthermore, the layout algorithm will throw a ArgumentError if there is a layout grid and the descendants of a group node are assigned to different layout grid cells or if there are group nodes that are associated with a GroupNodeHandlingPolicy other than FREE. In addition, the algorithm doesn't support multiple grids, i.e., all nodes have to be mapped to cells of the same layoutGrid.
Avoidance of Node Edge Overlaps
The layout can be configured such that overlaps between edges and nodes are avoided. However, it doesn't guarantee that they won't appear in the resulting layout. To avoid overlaps, it is possible to route the edges afterwards using an edge routing algorithm, e.g., OrganicEdgeRouter.
Maximum Duration
OrganicLayout allows restricting the duration which may be a suitable option to reduce the runtime required for large graphs. Note that restricting the stop duration may result in a lower layout quality. Furthermore, the actual runtime may exceed the stop duration since the layout algorithm still has to find a valid solution.
Substructures
The algorithm is also able to detect certain types of substructures in a graph (i.e., chains, stars, cycles, parallel, tree and group structures), and arrange these structures with special-purpose layout styles. Using substructure styles ensures that the corresponding structures are easily recognized in the graph. For the detection of substructures, it is optionally possible to consider nodeTypes, such that only nodes of the same user-defined type can form a substructure.
Constraints
The placement of the nodes can be influenced and restricted by additional constraints. Among others, the layout supports the following constraints; for more constraints see OrganicConstraintData<TNode>.
Port Placement Constraints
This layout algorithm handles port placement constraints by applying the PortPlacementStage as a postprocessing step.
Layout Stages
This class provides a configurable pipeline that contains various ILayoutStages. Each ILayoutStage can incorporate preprocessing or postprocessing steps into the layout calculation to streamline the input graph and enhance the resulting layout. Additionally, custom ILayoutStages can be added and executed either before or after the predefined ones.
The following default ILayoutStages are included:
- PortPlacementStage: Assigns edges to ports.
- GroupHidingStage: Removes group nodes and their adjacent edges before layout processing and reinserts them afterward. Note: This stage is disabled by default.
- SubgraphLayoutStage: Filters the graph to include only specific nodes and edges from a subgraph while retaining the positions of excluded elements. Note: This stage is disabled by default.
- ComponentLayout: Arranges graph components with customizable styles. The property style is set to circular component arrangement style.
- GenericLabeling: Efficiently places node and edge labels. The property fillEmptyScope is set to
falseand stopDuration is set to ZERO. - OrientationStage: Changes the layout orientation in four possible directions, with or without mirroring on the x or y-axis.
- SelfLoopRouter: Routes self-loops in a graph, allowing for either orthogonal or rounded routing styles. The property routingStyle is set to ROUNDED.
- ParallelEdgeRouter: Routes multiple edges between the same nodes in parallel.
With these layoutStages the layout algorithm is configured well, so they usually don't need to be changed.
Performance
Specifying a stopDuration can reduce the time the OrganicLayout takes to produce a result. The acceleration is achieved by both loosening the requirements for terminating the incremental improvement of the layout and switching to faster heuristics for some features, such as overlap removal or crossing optimization for group substructures. It should be noted that the stopDuration is not a guarantee for the maximum time spent, as the algorithm still has to produce a valid result.
With disconnected graphs containing large unconnected components, it can be beneficial to change the component arrangement style of the used componentLayout from the default style PACKED_CIRCLE to the faster ROWS style.
Default Values of Properties
| Name | Default | Description |
|---|---|---|
| allowNodeOverlaps | false | Node overlaps are not allowed. |
| automaticGroupNodeCompaction | true | Automatic group node compaction is enabled. |
| avoidNodeEdgeOverlap | false | Overlaps between nodes and edges are not avoided. |
| clusteringPolicy | OrganicLayoutClusteringPolicy.NONE | Automatic clustering is disabled. |
| compactnessFactor | 0.5 | |
| create3DLayout | false | The layout algorithm doesn't produce a 3D result. |
| defaultMinimumNodeDistance | 0 | |
| defaultPreferredEdgeLength | 40 | |
| deterministic | true | The layout algorithm is deterministic. |
| edgeLabelPlacement | EdgeLabelPlacement.GENERIC | Edge labels are placed by an independent labeling algorithm. |
| groupBoundsCalculator | GroupBoundsCalculator | |
| groupNodeCompactness | 0.4 | |
| nodeLabelPlacement | NodeLabelPlacement.CONSIDER | Node labels are considered. |
| qualityTimeRatio | 0.6 | |
| shapeConstraint | ShapeConstraint.NONE | |
| stopDuration | 30s | A TimeSpan of 30 seconds |
See Also
Developer's Guide
Members
Constructors
Creates a new OrganicLayout instance with default settings.
Parameters
Properties
Property Value
true if clusters are taken into account as group substructures, false otherwiseDefault Value
Sample Graphs
falseSee Also
Property Value
true if node overlaps are allowed, false otherwiseDefault Value
Sample Graphs
falseSee Also
Developer's Guide
API
- defaultMinimumNodeDistance
Property Value
true if automatic group node compaction is enabled, false otherwiseDefault Value
See Also
Property Value
true if the layout algorithm tries to avoid node/edge overlaps, false otherwiseDefault Value
See Also
Property Value
true if the layout algorithm tries to straighten maximal long chains, false otherwiseDefault Value
Sample Graphs
falseSee Also
Developer's Guide
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the given minimum size is less than
2
Default Value
See Also
Developer's Guide
API
- chainSubstructureStyle
Gets or sets the style specifier for chain substructures.
A chain is a simple edge path where the degree of the nodes is less than or equal to 2. Use property chainSubstructureSize to specify the minimum size a chain must have.
If there are user-defined nodeTypes, a chain substructure contains only nodes of the same type or only nodes without a type (i.e. null as type). This way, node types can be used to control which elements are allowed to form a substructure.
Property Value
Default Value
See Also
Developer's Guide
API
- chainSubstructureSize, edgeDirectedness
Property Value
true if the layout algorithm tries to force nodes of cycles on geometric circles, false otherwiseDefault Value
Sample Graphs
falseSee Also
Developer's Guide
Gets or sets the clustering policy that is applied to the input graph and before executing the arrangement algorithm.
By default, no clustering is applied, that is, NONE is set.
When a policy other than NONE is specified, the following steps are performed during the layout:
- A clustering algorithm is applied to the input graph.
- All nodes of the same cluster are put into a newly created group node.
- The layout is applied to the modified graph.
- Group nodes denoting clusters (inserted during step
2) are removed.
The user can also specify customized clusters by defining appropriate groups.
Property Value
Default Value
Smaller values result in less compact drawings, greater values result in more compact drawings.
The compactness value needs to lie in [0,1].
Property Value
[0,1]Throws
- Exception ({ name: 'ArgumentError' })
- if the specified value is outside the interval
[0,1]
Default Value
Sample Graphs
0See Also
Developer's Guide
Gets the ComponentLayout from the layoutStages of this instance.
Several features of the OrganicLayout require specific configurations of the used componentLayout instance to work properly. Unless the default instance is replaced with another instance of componentLayout, the OrganicLayout performs the necessary configurations itself, restoring the original configuration after it terminates.
If you need to replace the instance, modify the layoutStages stack using replace. If you want to remove a stage, consider disabling it instead.
Throws
- Exception ({ name: 'InvalidOperationError' })
- If there is no instance of the respective type in the layoutStages
Property Value
true if the layout algorithm creates a 3D result, false otherwiseDefault Value
See Also
Gets or sets the style specifier for cycle substructures.
A cycle is a simple edge path where the first and last node are identical. The algorithm only considers cycles where the number of edges connecting nodes of the cycle with the remaining nodes is less than or equal to 2. To define the minimum number of nodes a cycle must contain, use property cycleSubstructureSize (default is 4).
If there are user-defined nodeTypes, a cycle substructure contains only nodes of the same type or only nodes without a type (i.e. null as type). This way, node types can be used to control which elements are allowed to form a substructure.
Property Value
Default Value
See Also
Developer's Guide
API
- cycleSubstructureSize, edgeDirectedness
If there is no specific minimum node distance assigned to a node, this default minimum node distance is used.
The minimum node distance needs to be non-negative.
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the specified minimum node distance is negative
Default Value
Sample Graphs
40See Also
Developer's Guide
API
- allowNodeOverlaps, minimumNodeDistances
If there is no specific preferred edge length assigned to an edge, this default preferred edge length is used.
The preferred edge length needs to be non-negative.
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the specified edge length is negative
Default Value
Sample Graphs
40See Also
Developer's Guide
API
- preferredEdgeLengths
Property Value
true if this algorithm works deterministically, false otherwiseDefault Value
See Also
Developer's Guide
Gets or sets how the layout handles the position of edge labels.
The policy INTEGRATED tries to ensure that the edges are long enough to place the associated labels without overlapping each other. However, the applied simulation-based algorithm cannot always guarantee such results. Furthermore, the labels of an edge can overlap with other graph elements, including labels of other edges. To further improve the outcome, consider enabling the genericLabeling stage using the enabled property which runs as a post-processing step that reduces such overlaps.
To obtain suitable results, the following points have to be considered:
- Both the side and angle of the labels has to be specified relative to the edge (i.e., angleReference is set to RELATIVE_TO_EDGE_FLOW and sideReference is set to RELATIVE_TO_EDGE_FLOW). Otherwise, the resulting side/angle of the labels may be wrong.
- If only a subset of nodes is placed, the algorithm only considers labels of edges with at least one movable endpoint (i.e., source or target node).
- Labels of edges that connect a group node with one of its parent groups are not supported. The same applies to labels of grouped edges that are part of a substructure.
- Self-loops and parallel edges are handled by the selfLoopRouter and parallelEdgeRouter respectively. Thus, labels of such edges are not considered by the algorithm.
Property Value
Default Value
See Also
Developer's Guide
Gets the GenericLabeling from the layoutStages of this instance.
Throws
- Exception ({ name: 'InvalidOperationError' })
- If there is no instance of the respective type in the layoutStages
Gets or sets the ILayoutGroupBoundsCalculator instance used for calculating the size of group nodes.
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the specified ILayoutGroupBoundsCalculator is
null
Default Value
See Also
Developer's Guide
The compactness ranges from 0 to 1 where 0 results in group nodes not affecting the overall layout too much while 1 forces nodes in the same group to be clustered tightly.
The values need to lie in [0,1].
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if specified compactness value is outside the interval
[0,1]
Default Value
Sample Graphs
0.4See Also
Gets or sets the scope specifier for group substructures.
Group substructures that lie in the specified scope are treated as substructures in the layout process, i.e., the child nodes are arranged on a disk that is contained in the group node.
A group is a group substructure if it satisfies the following conditions.
- The group node does not contain any other group.
- The GroupNodeHandlingPolicy is FREE; see scopeModes.
- No node of the group is fixed.
- The group contains at least the specified minimum number of nodes
The scope specifiers indicate which group substructures are considered in the layout process.
Property Value
Default Value
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the given minimum size is less than
2
Default Value
See Also
Gets or sets the style specifier for group substructures.
Property Value
Default Value
See Also
Developer's Guide
API
- groupSubstructureScope, groupSubstructureSize
Gets or sets the layoutOrientation of the OrientationStage.
Gets or sets how the layout handles the position of node labels.
Property Value
Default Value
Sample Graphs
See Also
Developer's Guide
Gets the ParallelEdgeRouter from the layoutStages of this instance.
Throws
- Exception ({ name: 'InvalidOperationError' })
- If there is no instance of the respective type in the layoutStages
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the given minimum size is less than
2
Default Value
See Also
Gets or sets the style specifier for parallel substructures.
A parallel structure consists of a set of nodes (called the inner nodes) such that all nodes have degree two and are connected to the same pair of neighbors (called the outer nodes).
Use property parallelSubstructureSize to specify the minimum number of inner nodes a structure must contain to be handled as a substructure.
If there are user-defined nodeTypes, a parallel substructure contains only nodes of the same type or only nodes without a type (i.e. null as type). This way, node types can be used to control which elements are allowed to form a substructure.
Property Value
Default Value
See Also
Developer's Guide
API
- parallelSubstructureSize, edgeDirectedness
Property Value
true if parallel substructures are separated by node type, false if they may contain nodes of different typesDefault Value
Sample Graphs
See Also
Developer's Guide
API
- parallelSubstructureStyle, nodeTypes
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the specified distance is negative
Default Value
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].
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]
Default Value
See Also
Developer's Guide
Gets the SelfLoopRouter from the layoutStages of this instance.
Throws
- Exception ({ name: 'InvalidOperationError' })
- If there is no instance of the respective type in the layoutStages
Gets or sets the shape constraint for the result of the layout algorithm.
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the given restriction is
null
Default Value
Sample Graphs
See Also
Developer's Guide
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the given minimum size is less than
3
Default Value
See Also
Gets or sets the style specifier for star substructures.
A star consists of a set of degree one nodes that are all connected to the same node (called the root of the star). Use property starSubstructureSize to define the minimum number of nodes, including the root, a star must contain to be detected as a substructure.
If there are user-defined nodeTypes, by default, a star substructure only contains nodes of the same type or only nodes without a type (i.e. null as type), see starSubstructureTypeSeparation. This way, node types can be used to control which elements are allowed to form a substructure.
Property Value
Default Value
See Also
Developer's Guide
API
- starSubstructureSize, starSubstructureTypeSeparation, edgeDirectedness
Property Value
true if star substructures are separated by node type, false if they may contain nodes of different typesDefault Value
Sample Graphs
See Also
Developer's Guide
API
- starSubstructureStyle, nodeTypes
Gets or sets the duration that this layout algorithm is allowed to run before stopping gracefully.
Property Value
Throws
- Exception ({ name: 'ArgumentError' })
- if the specified duration has a negative value
Default Value
See Also
Developer's Guide
Gets or sets the style specifier for tree substructures.
Use property treeSubstructureSize to define the minimum number of nodes, including the root, a tree must contain to be detected as a substructure.
If there are user-defined nodeTypes, a tree substructure contains only nodes of the same type or only nodes without a type (i.e. null as type). This way, node types can be used to control which elements are allowed to form a substructure.
Property Value
Default Value
See Also
Developer's Guide
API
- treeSubstructureSize, edgeDirectedness
Methods
Calculates an organic arrangement of the graph.
Parameters
- graph: LayoutGraph
- the input graph
Implements
ILayoutAlgorithm.applyLayoutCalculates an organic arrangement of the graph.
Parameters
- graph: LayoutGraph
- the input graph
createLayoutData
(graph: LayoutGraph): OrganicLayoutData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel>Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the OrganicLayout.
createLayoutData
(graph: LayoutGraph): OrganicLayoutData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel>Parameters
- graph: LayoutGraph
- the graph that determines the generic type arguments of the created layout data
Return Value
- OrganicLayoutData<LayoutNode, LayoutEdge, LayoutNodeLabel, LayoutEdgeLabel>
- an instance of layout data that can be used to perform item-specific configurations for the given OrganicLayout.
Returns an instance of LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> that can be used to perform item-specific configurations for the OrganicLayout.
LayoutExecutor type is available at runtime.Parameters
- graph?: IGraph
- the graph that determines the generic type arguments of the created layout data
Return Value
- OrganicLayoutData<INode, IEdge, ILabel, ILabel>
- an instance of layout data that can be used to perform item-specific configurations for the given OrganicLayout.
See Also
Developer's Guide