Incremental Layout

The yFiles library provides unequaled support for incremental graph layout that seamlessly integrates with the "normal," i.e., non-incremental major layout algorithms.

Compared to a "normal" layout algorithm, which computes an all-new, fresh graph layout each time it is invoked, the main advantage of incremental layout is that distinct parts of a graph can be rearranged while the remainder of the graph is not, or only slightly, changed. Especially in an interactive environment, where a human user modifies a graph, i.e., adds and/or removes graph elements, this technique makes it possible to maintain the user's so-called "mental map" over a course of subsequent graph layouts.

The term "mental map" expresses a user's experience of a graph, which is most notably influenced by a consistent and largely invariable placement of a graph's elements in a sequence of layout algorithm invocations. "Normal" layout calculation does not consider the mental map in any way, in fact it is not unlikely that a graph's layout changes substantially for modifications as small as adding a single edge!

Table 5.17, “Layout support for incrementally modified graphs” lists the layout algorithms that provide support for incremental graph layout.

Table 5.17. Layout support for incrementally modified graphs

Layout Style Classname Note
Hierarchical IncrementalHierarchicLayouter Supports incremental hierarchical layout as well as classic hierarchical layout. See the description of incremental hierarchical layout for more information.
Organic SmartOrganicLayouter Incremental layout support is provided by means of the "Scope" feature. See the description of smart organic layout for more information.
Tree TreeLayouter, BalloonLayouter, GenericTreeLayouter Support for incremental layout is provided by TreeLayouter by means of the default "child comparator" implementation. BalloonLayouter can be set to "layout from sketch" mode. GenericTreeLayouter supports incremental layout by means of the default NodePlacer implementation. See the descriptions of tree layout, balloon layout, and generic tree layout, respectively for more information.

Table 5.18, “Routing support for incrementally modified graphs” lists the routing algorithms that provide support for incremental edge routing.

Table 5.18. Routing support for incrementally modified graphs

Routing Style Classname Note
Organic OrganicEdgeRouter Incremental routing support is provided by the "Route Selected Edge Only" feature. See the routing options of organic edge routing for more information.
Orthogonal OrthogonalEdgeRouter, ChannelEdgeRouter, BusRouter, and EdgeRouter Incremental routing support is provided by means of the "Sphere of Action" (OrthogonalEdgeRouter, EdgeRouter), "Affected Edges" (ChannelEdgeRouter), and "Scope"/"Fixed Edges" (BusRouter) features, respectively. See the routing options of OrthogonalEdgeRouter, ChannelEdgeRouter, BusRouter, and EdgeRouter for more information.

Use Cases

Incremental layout is closely related to "layout from sketch," where a given arrangement of nodes is taken as the starting point for a layout calculation and also as a specification for the calculation's desired outcome. Consequently, "layout from sketch" takes a major role in an incremental layout algorithm's functionality.

Incremental layout has two major use cases, which both involve "layout from sketch:"

  • Interactive creation of a graph structure where the layout calculation is performed dynamically with each newly inserted graph element.
  • Subsequent improvement of distinct parts from an already existing graph layout, where the remainder of the layout stays mainly unchanged.

Related Concepts

Partial layout is a related concept that also allows to layout distinct parts of a diagram. With this concept, it is possible to use completely different layout styles for parts of a diagram and add the results to the original, unaltered remainder of the layout. Layout algorithms that provide support for incremental layout, however, will often yield a more sound and truly integrated overall layout of a diagram.