documentationfor yFiles for HTML 2.6

HierarchicLayoutCore

This class arranges graphs in a hierarchic/layered fashion and supports complete re-layout as well as incremental graph layout.

Inheritance Hierarchy
MultiStageLayout
HierarchicLayoutCore
Implemented Interfaces

Remarks

Note that class HierarchicLayout offers a facade to this class which is easier to use. Hence, we strongly recommend to not directly use class HierarchicLayoutCore.

Layout Style

The nodes are distributed into layers such that most of the edges point to the main layout direction. The order of the nodes within the layers ensures that the number of edge crossings is as small as possible. There are different edge routing styles available. Edges can be orthogonal, polyline or octilinear.

Hierarchical diagrams are commonly used for the visualization of hierarchical data, since they facilitate the identification of dependencies and relationships among the nodes of the graph. Possible application domains are the following: workflow visualization, call graph visualization, entity-relationship diagrams, biochemical pathways and network management.

Hierarchic Layout obtained with default settings

Concept

The layout algorithm runs in three main phases:

  • Layering – The nodes are distributed into layers by means of layerer. If the layout orientation is top-to-bottom, the nodes in each layer are arranged horizontally while the layers are ordered vertically top-to-bottom.
  • Sequencing – The order of the nodes in each layer is determined such that the number of edge crossings is as small as possible. To specify the sequencing algorithm, use sequencer.
  • Drawing – The layout algorithm assigns the final coordinates to all nodes and routes the edges.

Features

In order to customize this layout algorithm, modify the Layerer, Sequencer, PortAllocator, DrawingDistanceCalculator, and NodePlacer instances.

This layout algorithm is able to incrementally add new elements to an existing drawing of a graph. In order to add elements incrementally, register a IDataProvider with the graph using the INCREMENTAL_HINTS_DP_KEY DataProvider key and associate the hints obtained from the IIncrementalHintsFactory with the elements to be added incrementally.

HierarchicLayoutNodeLayoutDescriptor and HierarchicLayoutEdgeLayoutDescriptor instances can be used for specifying individual information (e.g. distances or routing styles) for each node and edge in the graph. The descriptors are bound to the graph using IDataProviders registered with NODE_LAYOUT_DESCRIPTOR_DP_KEY or EDGE_LAYOUT_DESCRIPTOR_DP_KEY.

HierarchicLayoutCore supports two approaches to connect edges on a specific side or even an exact location to a node. PortConstraints define a single constraint for the ports of an edge. To realize more complex port restrictions, several PortCandidates or PortCandidateSets can be assigned to edges or nodes. If an edge with registered PortCandidates connects to nodes with PortCandidateSets, the layouter will try to match both collections to find an appropriate port. In case there is no matching port candidate, a PortCandidate specified for the edge is preferred. Since their simultaneous existence at the same node may be ambiguous, it is not recommended to use a combination of PortConstraints and PortCandidates in the same layout.

This algorithm specifies a LabelLayoutTranslator instance as the current labeling and configures it such that the node labels are passed to it by setting translateNodeLabels to true.

In order to enable integrated edge labeling of this algorithm, make sure LabelLayoutTranslator is registered and edge labels are being translated and written back after the layout.

Moreover, this algorithm supports layer and sequence constraints. These constraints can be specified using a ILayerConstraintFactory and ISequenceConstraintFactory, respectively.

Default Values of Properties

componentLayoutEnabledfalse is disabled.
gridSpacing0There is no grid specified.
maximumDuration<code>0x7FFFFFFF</code>The layout algorithm runs unrestricted.

Type Details

yfiles module
layout-hierarchic
yfiles-umd modules
layout-familytree, layout-hierarchic, layout-radial, layout
Legacy UMD name
yfiles.hierarchic.HierarchicLayoutCore

See Also

Constructors

Properties

Methods

Constants