documentationfor yFiles for HTML 3.0.0.2

OrganicLayout

This layout algorithm arranges graphs in an organic fashion.

Inheritance Hierarchy
OrganicLayout
Implemented Interfaces

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.

Organic Layout obtained with default settings

Organic Layout exhibiting symmetric properties

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.

Organic Layout without applying specific layout styles to substructures

Organic Layout of the same graph applying specific layout styles to the detected substructures

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>.

Nodes can be enforced to be placed on horizontal and vertical lines addAlignmentConstraint. In this example, the nodes with label "H" are forced on a horizontal line, and nodes with label "V" are forced on a vertical line.

Nodes can be forced on rectangles and ellipses using addRectangle and addEllipse, respectively. In this example, the nodes with label "R" are forced on a square, and nodes with label "E" are forced on a circle. The sizes of the geometric structures are determined automatically.

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:

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

allowNodeOverlapsfalseNode overlaps are not allowed.
automaticGroupNodeCompactiontrueAutomatic group node compaction is enabled.
avoidNodeEdgeOverlapfalseOverlaps between nodes and edges are not avoided.
clusteringPolicyNONEAutomatic clustering is disabled.
compactnessFactor0.5
create3DLayoutfalseThe layout algorithm doesn't produce a 3D result.
defaultMinimumNodeDistance0
defaultPreferredEdgeLength40
deterministictrueThe layout algorithm is deterministic.
edgeLabelPlacementGENERICEdge labels are placed by an independent labeling algorithm.
groupBoundsCalculatorGroupBoundsCalculator
groupNodeCompactness0.4
nodeLabelPlacementCONSIDERNode labels are considered.
qualityTimeRatio0.6
shapeConstraintNONE
stopDuration30sA of 30 seconds

Type Details

yFiles module
algorithms

See Also

For large tree structures, applying a tree layout algorithm like, e.g., the RadialTreeLayout produces more suitable results. Hence, for tree-like input graphs, we recommend choosing a suitable treeSubstructureStyle, in which case the layout of subtrees is automatically delegated to a tree layout algorithm.

Constructors

Properties

Methods

Constants