A layout algorithm that arranges graphs in an organic fashion, using a force-directed drawing approach.
Remarks
Layout Style
The organic layout style 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, close to their adjacent nodes. Distances between neighbors and edge lengths are highly uniform and edges are drawn as 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
This algorithm uses a force-directed approach to place the nodes of the input graph. The graph is modeled as a physical system with 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
The tree beautifier feature activates a special layout style for subgraphs with a tree structure. These subgraphs will be arranged using an algorithm dedicated to tree graphs and incorporated into the main organic diagram.
Several parameters for the internal force-directed drawing algorithm can be modified. For example, the repulsion, attraction and initial temperature can be controlled. This allows experts to configure and fine-tune the algorithm with respect to their needs.
Default Values of Properties
activateTreeBeautifier | false | Subtrees are not handled differently. |
considerNodeSizes | true | Node sizes are considered. |
deterministic | false | The layout algorithm is non-deterministic. |
groupBoundsCalculator | MinimumSizeGroupBoundsCalculator
| |
groupNodePolicy | LAYOUT
| |
hideGroupsStageEnabled | false | The stage responsible for hiding group nodes is activated. |
maximumDuration | 30000 | |
orientationLayoutEnabled | true | The orientation |
preferredEdgeLength | 80 | |
scope | ALL
|
Type Details
- yfiles module
- layout-organic
- yfiles-umd modules
- layout-multipage, layout-organic, layout
- Legacy UMD name
- yfiles.organic.ClassicOrganicLayout
See Also
Constructors
Creates a new ClassicOrganicLayout with default settings.
Parameters
A map of options to pass to the method.
- repulsion - number
The node repulsion value. This option sets the repulsion property on the created object.
- attraction - number
The edge attraction value. This option sets the attraction property on the created object.
- groupBoundsCalculator - ILayoutGroupBoundsCalculator
The ILayoutGroupBoundsCalculator instance used for calculating the size of group nodes. This option sets the groupBoundsCalculator property on the created object.
- groupNodeCompactness - number
The compactness of group nodes. This option sets the groupNodeCompactness property on the created object.
- groupNodePolicy - GroupsPolicy
The policy for the handling of group nodes. This option sets the groupNodePolicy property on the created object.
- initialTemperature - number
The initial temperature for the force-directed layout process. This option sets the initialTemperature property on the created object.
- finalTemperature - number
The absolute, final temperature value, which will cause the algorithm to stop if the average temperature falls under this value. This option sets the finalTemperature property on the created object.
- deterministic - boolean
Whether or not the deterministic mode of the layout algorithm is enabled. This option sets the deterministic property on the created object.
- activateTreeBeautifier - boolean
Whether or not to arrange subtrees of the input graph in a special, optimized tree style. This option sets the activateTreeBeautifier property on the created object.
- gravityFactor - number
The gravity factor whose magnitude determines the strength of the force towards the barycenter of the graph. This option sets the gravityFactor property on the created object.
- scope - OrganicLayoutScope
The scope that determines which nodes are placed by this algorithm. This option sets the scope property on the created object.
- initialPlacement - InitialPlacement
The strategy for the initial placement of nodes. This option sets the initialPlacement property on the created object.
- maximumDuration - number
The maximum duration in milliseconds that this layout algorithm is allowed to run. This option sets the maximumDuration property on the created object.
- iterationFactor - number
The iteration factor which influences the maximum number of optimization iterations the algorithm may perform. This option sets the iterationFactor property on the created object.
- preferredEdgeLength - number
The default preferred edge length. This option sets the preferredEdgeLength property on the created object.
- considerNodeSizes - boolean
Whether or not to consider node sizes during layout calculation. This option sets the considerNodeSizes property on the created object.
- orientationLayoutEnabled - boolean
Whether or not the ILayoutStage that modifies the orientation of the layout is activated. This option sets the orientationLayoutEnabled property on the created object.
- labeling - ILayoutStage
The ILayoutStage that places the labels of the input graph. This option sets the labeling property on the created object.
- selfLoopRouter - ILayoutStage
The ILayoutStage that routes self-loops. This option sets the selfLoopRouter property on the created object.
- parallelEdgeRouter - ILayoutStage
The ILayoutStage that routes parallel edges. This option sets the parallelEdgeRouter property on the created object.
- componentLayout - ILayoutStage
The ILayoutStage that arranges the connected components of an input graph. This option sets the componentLayout property on the created object.
- subgraphLayout - ILayoutStage
The ILayoutStage that constrains the layout process to a subgraph of the input graph. This option sets the subgraphLayout property on the created object.
- hideGroupsStage - ILayoutStage
The ILayoutStage that hides the group nodes of the input graph. This option sets the hideGroupsStage property on the created object.
- orientationLayout - ILayoutStage
The ILayoutStage that modifies the orientation of a computed layout. This option sets the orientationLayout property on the created object.
- layoutOrientation - LayoutOrientation
The main orientation of the layout. This option sets the layoutOrientation property on the created object.
- selfLoopRouterEnabled - boolean
Whether or not the ILayoutStage used for routing self-loops is activated. This option sets the selfLoopRouterEnabled property on the created object.
- labelingEnabled - boolean
Whether or not the ILayoutStage used for placing the labels of the input graph is activated. This option sets the labelingEnabled property on the created object.
- hideGroupsStageEnabled - boolean
Whether or not the ILayoutStage used for hiding group nodes is activated. This option sets the hideGroupsStageEnabled property on the created object.
- componentLayoutEnabled - boolean
Whether or not the ILayoutStage used for arranging the components of the graph is activated. This option sets the componentLayoutEnabled property on the created object.
- parallelEdgeRouterEnabled - boolean
Whether or not the ILayoutStage used for routing parallel edges is activated. This option sets the parallelEdgeRouterEnabled property on the created object.
- subgraphLayoutEnabled - boolean
Whether or not the ILayoutStage used for constraining the layout process to a subgraph of the input graph is activated. This option sets the subgraphLayoutEnabled property on the created object.
Properties
Gets or sets whether or not to arrange subtrees of the input graph in a special, optimized tree style.
Remarks
Subtrees will be arranged in a balloon-like fashion.
If this feature is disabled, subgraphs with a tree structure are arranged using the same style as for the rest of the graph.
In case that the input graph is a tree and this feature is enabled, the whole graph will be drawn in a tree-like style.
Default Value
false
.Subtrees are not handled differently.
Sample Graphs
Gets or sets the edge attraction value.
Remarks
The attraction influences the attractive force associated with edges. A higher attraction value can lead to more compact drawings, whereas a lower value potentially enlarges drawings.
The attraction is defined to range from 0
to 2
.
Default Value
1
.Throws
- Exception({ name: 'ArgumentError' })
- if the attraction value is negative or greater than
2
Sample Graphs
Gets or sets the ILayoutStage that arranges the connected components of an input graph.
Default Value
ComponentLayout.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for arranging the components of the graph is activated.
Remarks
Default Value
true
.The stage that arranges connected graph components is activated.
See Also
Defined in
Gets or sets whether or not the deterministic mode of the layout algorithm is enabled.
Remarks
Default Value
false
.The layout algorithm is non-deterministic.
Gets or sets the absolute, final temperature value, which will cause the algorithm to stop if the average temperature falls under this value.
Remarks
Default Value
1
.See Also
Gets or sets the gravity factor whose magnitude determines the strength of the force towards the barycenter of the graph.
Remarks
- A high gravity factor value leads to layouts with nodes clustered around the barycenter of the graph.
- A low gravity factor value stretches the outskirts of the graph far away from the barycenter.
Default Value
0
.Sample Graphs
2.0
.Gets or sets the ILayoutGroupBoundsCalculator instance used for calculating the size of group nodes.
Default Value
MinimumSizeGroupBoundsCalculator.Gets or sets the compactness of group nodes.
Remarks
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 compactness values needs to lie within [0,1]
.
Default Value
0.2
.Throws
- Exception({ name: 'ArgumentError' })
- if compactness value does not lie within the interval
[0,1]
Sample Graphs
Gets or sets the policy for the handling of group nodes.
Remarks
Default Value
LAYOUT.Throws
- Exception({ name: 'ArgumentError' })
- if the given policy is unknown
Gets or sets the ILayoutStage that hides the group nodes of the input graph.
Default Value
HideGroupsStage.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for hiding group nodes is activated.
Remarks
Default Value(Overrides the default value defined in MultiStageLayout)
false
.The stage responsible for hiding group nodes is activated.
See Also
Defined in
Gets or sets the strategy for the initial placement of nodes.
Remarks
Default Value
ZERO.Throws
- Exception({ name: 'ArgumentError' })
- if the given initial placement mode is unknown
Gets or sets the initial temperature for the force-directed layout process.
Remarks
The algorithm starts with an initial temperature. During the iterations of the layout process, this temperature decreases and if it reaches a certain limit, the process terminates. This limit can be controlled using finalTemperature.
The initial temperature will be multiplied by the preferred edge length and then assigned as the actual initial heat of nodes.
Default Value
0.65
.See Also
Gets or sets the ILayoutStage that places the labels of the input graph.
Default Value
See Also
Defined in
Gets or sets whether or not the ILayoutStage used for placing the labels of the input graph is activated.
Remarks
Default Value
false
.The stage responsible for label placement is deactivated.
See Also
Defined in
Gets or sets the main orientation of the layout.
Remarks
Default Value
TOP_TO_BOTTOM.Throws
- Exception({ name: 'ArgumentError' })
- if the specified orientation does not match a default layout orientation
See Also
Defined in
Gets or sets the maximum duration in milliseconds that this layout algorithm is allowed to run.
Remarks
Default Value
30000
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified duration has a negative value
Gets or sets the ILayoutStage that modifies the orientation of a computed layout.
Default Value
OrientationLayout.See Also
Defined in
Sets whether or not the ILayoutStage that modifies the orientation of the layout is activated.
Default Value
true
.The orientation
See Also
Overrides
Gets or sets the ILayoutStage that routes parallel edges.
Default Value
ParallelEdgeRouter.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for routing parallel edges is activated.
Remarks
Default Value
true
.The stage that routes parallel edges is activated.
See Also
Defined in
Gets or sets the default preferred edge length.
Remarks
The default preferred edge length will be used for edges that don't have an individual length preference defined via a IDataProvider registered with key PREFERRED_EDGE_LENGTH_DP_KEY.
The preferred edge length needs to be non-negative.
Default Value
80
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified edge length is negative
Sample Graphs
Gets or sets the node repulsion value.
Remarks
The repulsion influences the forces between nodes. A higher repulsion value can lead to more compact drawings, whereas a lower repulsion value potentially enlarges drawings.
The repulsion is defined to range from 0
to 2
.
Default Value
1
.Throws
- Exception({ name: 'ArgumentError' })
- if the repulsion value is negative or greater than
2
Sample Graphs
Gets or sets the scope that determines which nodes are placed by this algorithm.
Default Value
ALL.Throws
- Exception({ name: 'ArgumentError' })
- if the given scope is unknown
See Also
Gets or sets the ILayoutStage that routes self-loops.
Default Value
SelfLoopRouter.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for routing self-loops is activated.
Remarks
Default Value
true
.The stage that routes self-loops is activated.
See Also
Defined in
Gets or sets the ILayoutStage that constrains the layout process to a subgraph of the input graph.
Default Value
SubgraphLayout.See Also
Defined in
Gets or sets whether or not the ILayoutStage used for constraining the layout process to a subgraph of the input graph is activated.
Remarks
Default Value
false
.The stage that constrains the input graph to a subgraph is deactivated.
See Also
Defined in
Methods
Appends the given ILayoutStage to the layout pipeline.
Remarks
Parameters
A map of options to pass to the method.
- stage - ILayoutStage
- the ILayoutStage instance to be added
See Also
Defined in
Calculates a layout for the given graph and applies it directly to the graph.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Implements
Calculates an organic arrangement of the given graph.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
Implements
Checks the sizes of the nodes to be non-zero.
Parameters
A map of options to pass to the method.
- g - LayoutGraph
- The graph to check.
Defined in
Deactivates all predefined ILayoutStages so that upon applyLayout only the layout algorithm will be executed.
See Also
Defined in
Prepends the given ILayoutStage to the layout pipeline.
Remarks
Parameters
A map of options to pass to the method.
- stage - ILayoutStage
- the ILayoutStage instance to be added
See Also
Defined in
Removes the given ILayoutStage from the layout pipeline.
Remarks
Parameters
A map of options to pass to the method.
- stage - ILayoutStage
- a ILayoutStage to be removed from the layout pipeline
See Also
Defined in
Constants
A data provider key for marking the nodes that are part of the current scope.
Domain | YNode | |
Values | boolean | true if the node is part of the scope, false or null otherwise |
See Also
A data provider key for marking group nodes as fixed.
Remarks
The content of a fixed group node will not be changed by this algorithm but be treated as fixed.
The groups marked as fixed will be considered for the group node policy settings FIXED and LAYOUT. When IGNORE is chosen, the data provider registered with this key will be ignored.
Domain | YNode | the group nodes of the input graph |
Values | boolean | true if the group node should be fixed, false otherwise |
See Also
A data provider key for defining an individual preferred length for each edge.
Domain | Edge | |
Values | number | a non-negative length for each edge or null to fallback to the default edge length |