Class OrganicLayouter
is a
multi-purpose layouter for undirected graphs.
It produces clear representations of complex networks and is especially fit for
application areas such as
OrganicLayouter is based on the force-directed layout paradigm. When calculating a layout, the nodes are considered to be physical objects with mutually repulsive forces, like, e.g., protons or electrons. The connections between nodes also follow the physical analogy and are considered to be metal springs attached to the pair of nodes. These springs produce repulsive or attractive forces between their end points if they are too short or too long. The layouter simulates these physical forces and rearranges the positions of the nodes in such a way that the sum of the forces emitted by the nodes and the edges reaches a (local) minimum.
Resulting layouts often expose the inherent symmetric and clustered structure of a graph, a well-balanced distribution of nodes and few edge crossings.
The layouter is well suited for the visualization of highly connected backbone regions with attached peripheral ring or star structures. These structurally different regions of a network can be easily identified by looking at a drawing produced by this layouter.
See the Smart Organic Layouter for another layouter which makes use of this layouter and related layouting techniques.
Figure 5.38. Sample layouts produced by class OrganicLayouter
|
|
|
|
| The network represents mount point relationships in a shared file system. | The inherent symmetry of this recursively defined graph gets exposed nicely. | The inherent symmetry of this extended short-cut grid-graph gets exposed nicely. |
Class OrganicLayouter knows a number of data provider keys which are used to retrieve supplemental layout data for a graph's elements. The data is bound to the graph by means of a data provider, which is registered using a given look-up key. Table 5.20, “Data provider look-up keys” lists all look-up keys for OrganicLayouter.
Binding supplemental layout data to a graph is described in the section called “Providing Supplemental Layout Data”.
Table 5.20. Data provider look-up keys
| Key | Element Type | Value Type | Description |
|---|---|---|---|
| GROUP_DPKEY |
Node | boolean | For each node a boolean value indicating whether it is a group node or not. |
| NODE_ID_DPKEY |
Node | Object | For each node an Object that serves as a unique ID. |
| PARENT_NODE_ID_DPKEY |
Node | Object | For each node an Object indicating the group node it belongs to. The Object matches the unique ID of a group node that is in the same graph. |
| SPHERE_OF_ACTION_NODES |
Node | boolean | For each node a boolean value indicating whether it should be treated as selected or not. |
| PREFERRED_EDGE_LENGTH_DATA |
Edge | int | For each edge an integral value that indicates its preferred length. |
| FIXED_GROUP_NODES_DPKEY |
Node | boolean | For each group node a boolean value indicating whether its content should remain fixed or not. |
Setup of a graph's hierarchical organization and using the grouping keys (GROUP_DPKEY, NODE_ID_DPKEY, and PARENT_NODE_ID_DPKEY) is described in detail in the section called “Setup for Layout”.
Organic layout provides a set of options that influence its behavior. These options can be set using the setter methods of class OrganicLayouter.
Determines the set of nodes from the graph that should be processed.
When only a subset should be rearranged, a data provider holding the selection
state for each node is looked up.
The data provider is expected to be registered with the graph using key
SPHERE_OF_ACTION_NODES
.
Figure 5.39, “Initial graph and an augmentation” and Figure 5.40, “Incremental layout of augmented graph” show how the "Sphere of Action" option enables different kinds of incremental layout strategies. To perform incremental layout, some nodes have to be marked as "selected." Only (or mostly) the selected nodes will be arranged by OrganicLayouter. All other nodes will stay at their original position.
Figure 5.40. Incremental layout of augmented graph
![]() |
![]() |
![]() |
|
Setting "Sphere of Action" to
ALL |
Setting "Sphere of Action" to
ONLY_SELECTION |
Setting "Sphere of Action" to
MAINLY_SELECTION |
Determines the initial placement of the nodes from where the layuter starts to find a good resulting layout.
Allows to specify the general preferred length for all edges. The layouter tries to arrange the nodes in such a way that the edges have the desired edge length. If "Obey Node Size" is checked, then the edge length is measured from node border to node border. Otherwise, the edge length is measured from node center to node center.
To specify the preferred edge length for each edge individually, a data
provider holding such supplemental layout data can be bound to the graph.
The data provider is expected to be registered with the graph using key
PREFERRED_EDGE_LENGTH_DATA
.
Note that in the absence of an individual preferred edge length the general
preferred edge length will be used.
Regulates the tendency of the nodes to be placed near the barycenter of the resulting layout. The greater the factor, the closer are the nodes to the barycenter. Negative values lead to huge layouts.
Figure 5.41, “Effect of the gravity factor” shows the effect of different gravity settings. The magnitude of the gravity factor determines the strength of the force towards the barycenter of the graph. A high gravity factor tends to cluster nodes around the barycenter of the graph. A low factor stretches the outskirts of the graph far away from the center. By default a value of 0.0 is assumed.
Whether or not to obey the size of the nodes when calculating the layout. The distance between two nodes is calculated with respect to the node sizes, i.e., for equal preferred edge lengths, activating this feature will lead to bigger layouts.
This setting determines the strength of the force that edges oppose on their adjacent nodes. Higher values result in edges which better obey the given preferred edge length.
This setting determines the strength of the forces that nodes oppose on their topological neighbors. Higher values result in greater node distances. In this case, preferred edge lengths are more likely to be longer than the preferred edge length.
Figure 5.42, “A graph laid out using different repulsion factors” shows how the "Repulsion" option affects the layout. The value determines repulsion through the inverse power of the distance between two nodes, i.e., smaller values lead to slowly degrading repulsion, whereas greater values simulate local repulsion only. Notice the increasing localness of mutual node repulsion for increasing factors.
Activates an experimental feature that lays out tree-like sub-structures of the graph in an optimized way.
Influences the quality and execution time of this layouter. Greater values may result in better quality and most likely longer execution time.
Sets the maximal duration of the layout process in milliseconds. If this upper bound is hit during the layout process, the quality of the may not be optimal. Increasing this values increases the likeliness of an optimal layout.
Whether or not the layout process should be deterministic. In deterministic mode the layouter produces identical results for identical input graphs.
The organic layout algorithm implemented in yFiles allows to layout
hierarchically organized graphs.
Both position and dimension of group nodes will be calculated by the algorithm.
Additional size requirements (insets or custom labels) can be provided for each
group node separately (see
API
and
API
).
Determines the basic policy for the layout process.
To keep the contents of only certain group nodes fixed, a data provider holding
such supplemental layout data can be bound to the graph.
The data provider is expected to be registered with the graph using key
FIXED_GROUP_NODES_DPKEY
.
This setting can be used to control the compactness of group nodes. Larger values will lead to more compact group nodes but inter-edges may be longer and nodes inside group nodes tend to get clutched together at the center of the group node. Smaller values will result in larger group nodes in favor of shorter inter-edge lengths and more evenly spread nodes inside group nodes.
OrganicLayouter supports incremental layout through the "Sphere of Action" feature. See the above description.
Layout module OrganicLayoutModule.java presents the setup of class OrganicLayouter in an application context.
|
Copyright ©2004-2008, yWorks GmbH. All rights reserved. |