Search
LayeredLayout Class
Remarks See Also
 






Implements a layered graph layout algorithm.

Namespace: MindFusion.Graphs
File: LayeredLayout.js

 Syntax

JavaScript  Copy Code

// class
LayeredLayout.prototype = {}

 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 of the Diagram class. The method lays out all subgraphs in a diagram.

The final appearance of arranged graphs depends mostly on the direction value, which defines the overall orientation of the layout. The layerDistance and nodeDistance values specify how much space to leave between adjacent layers and adjacent nodes in a layer.

 Example

The following example applies a LayeredLayout to a diagram:

JavaScript  Copy Code
var layout = new MindFusion.Graphs.LayeredLayout();
layout.direction = MindFusion.Graphs.LayoutDirection.TopToBottom;
layout.siftingRounds = 3;
diagram.arrange(layout);

 Inheritance Hierarchy

MindFusion.Graphs.Layout
    MindFusion.Graphs.LayeredLayout

 See Also