Search
LayeredLayout Class
Remarks See Also
 





Implements a layered graph layout algorithm.

Namespace: MindFusion.Diagramming.Wpf.Layout
Assembly: MindFusion.Diagramming.Wpf

 Syntax

C#  Copy Code

public class LayeredLayout : Layout

Visual Basic  Copy Code

Public Class LayeredLayout
    Inherits Layout

 Remarks

This algorithm assigns diagram nodes to distinct horizontal or vertical layers. While arranging the layers, the layout routine seeks to meet the following criteria:

  • connected nodes must be placed close together;
  • links must flow in one direction if possible;
  • links must cross as few layers as possible;
  • links must not cross other links;

To apply this layout to a diagram, create a LayeredLayout instance, set its members and invoke the Arrange method. Arrange lays out all subgraphs in a diagram, unless the Root property is set.

The final appearance of arranged graphs depends mostly on the Orientation and Direction properties which define the overall orientation of the layout. The LayerDistance and NodeDistance properties specify how much space to leave between adjacent layers and adjacent nodes in a layer.

The performance of LayeredLayout is dependent on the number of links in the diagram. At its first stage, the algorithm looks for the longest sequence of links in the graph and builds the node layers along it. That stage can be the most time consuming if there are a lot of links in a graph, so there is the TimeLimit property provided to control how much time the layout routine is allowed to spend on path-finding. Next, if there are layers much longer than the other ones and SplitLayers is enabled, nodes from these layers are moved to new ones so the graph width is uniformly distributed.

The layout routine continues by shuffling nodes and link points across their layers, so the criteria mentioned above are approximated. Finally, link ends are aligned to anchor points if Anchoring is enabled and the distance between outermost links is decreased as set in LinksCompactFactor.

The layered graph layout algorithm produces best results if it can place link ends at arbitrary positions over nodes' outlines, that is, when using the Ignore value. If your application logic requires links to be always attached to anchor points, use the other two values. In such cases Reassign would yield better results.

 Inheritance Hierarchy

System.Object
    System.MarshalByRefObject
        System.ComponentModel.Component
            MindFusion.Diagramming.Wpf.Layout.Layout
                MindFusion.Diagramming.Wpf.Layout.LayeredLayout

 See Also