Class LayeredDigraphLayout
Extends Layout. This arranges nodes of directed graphs into layers (rows or columns). There are many samples that use LayeredDigraphLayout. If you want to experiment interactively with most of the properties, try the Layered Digraph Layout sample.
If the diagram is structured in a tree-like fashion, it may be better to use TreeLayout, which has more options specific to trees. TreeLayout is much faster than LayeredDigraphLayout, and can handle a limited number of links that would prevent the graph structure from being a true tree (i.e. some nodes having multiple parents).
This layout makes use of a LayoutNetwork of LayeredDigraphVertexes and LayeredDigraphEdges that normally correspond to the Nodes and Links of the Diagram.
The layout algorithm consists of four-major steps: Cycle Removal, Layer Assignment, Crossing Reduction, and Straightening and Packing.
Constructor Summary Details
Returns | Name | Description |
---|---|---|
LayeredDigraphLayout()
|
Properties Summary Details
Returns | Name | Description |
---|---|---|
{EnumValue}
|
aggressiveOption
|
Gets or sets which aggressive option is being used to look for link crossings. More...
The default value is LayeredDigraphLayout.AggressiveLess.
|
{number}
|
columnSpacing
|
Gets or sets the size of each column. More...
This value must be positive and it defaults to 25.
|
{EnumValue}
|
cycleRemoveOption
|
Gets or set which cycle removal option is used. More...
The default value is LayeredDigraphLayout.CycleDepthFirst.
|
{number}
|
direction
|
Gets or sets the direction the graph grows towards. More...
0 is towards the right, 90 is downwards, 180 is towards the left, and 270 is upwards.
The default value is 0.
|
{EnumValue}
|
initializeOption
|
Gets or sets which indices initialization option is being used. More...
The default value is LayeredDigraphLayout.InitDepthFirstOut.
|
{number}
|
iterations
|
Gets or sets the number of iterations to be done. More...
The value must be non-negative. The default value is 4.
|
{EnumValue}
|
layeringOption
|
Gets or sets which layering option is being used. More...
The default value is LayeredDigraphLayout.LayerOptimalLinkLength.
|
{number}
|
layerSpacing
|
Gets or sets the size of each layer. More...
This value must be positive and it defaults to 25.
|
{number}
|
maxColumn
|
This read-only property returns the largest column value.
|
{number}
|
maxIndex
|
This read-only property returns the largest index value.
|
{number}
|
maxIndexLayer
|
This read-only property returns the larges index layer.
|
{number}
|
maxLayer
|
This read-only property returns the largest layer value.
|
{number}
|
minIndexLayer
|
This read-only property returns the smallest index layer.
|
{number}
|
packOption
|
Gets or sets the options used by the straighten and pack function,
The default value is LayeredDigraphLayout.PackAll.
|
{boolean}
|
setsPortSpots
|
Gets or sets whether the FromSpot and ToSpot of each link should be set
to values appropriate for the given value of LayeredDigraphLayout.direction. More...
The default value is true.
|
- Properties borrowed from class Layout:
- arrangementOrigin, diagram, group, isInitial, isOngoing, isRealtime, isRouting, isValidLayout, isViewportSized, network
Method Summary Details
Returns | Name | Description |
---|---|---|
assignLayers()
1.1
|
Assigns every vertex in the input network to a layer. More...
The layer is a non-negative integer describing which row of vertexes each vertex belongs in.
(Do not confuse this concept of "layer" with Layers that control the Z-ordering of Parts.)
The layering satisfies the following relationship: if L is a link from node U to node V, then U.layer > V.layer. This method can be overridden to customize how nodes are assigned layers. Please read the Introduction page on Extensions for how to override methods and how to call this base method. By default, this does the appropriate assignments given the value of layeringOption. |
|
commitLayers(layerRects, offset)
1.4
|
This overridable method is called by commitLayout
to support custom arrangement of bands or labels across each layout layer. More...
By default this method does nothing.
The coordinates used in the resulting Rects may need to be offset by the Layout.arrangementOrigin. |
|
commitLayout()
|
Set the fromSpot and toSpot on each Link, position each Node according
to the vertex position, and then position/route the Links. More...
This calls the commitNodes and commitLinks methods, the latter only if isRouting is true. You should not call this method -- it is a "protected virtual" method. Please read the Introduction page on Extensions for how to override methods and how to call this base method. |
|
commitLinks()
|
Routes the links. More...
This is called by commitLayout. This is only called if Layout.isRouting is true. See also commitNodes. Please read the Introduction page on Extensions for how to override methods and how to call this base method. |
|
commitNodes()
|
Commit the position of all nodes. More...
This is called by commitLayout. See also commitLinks. Please read the Introduction page on Extensions for how to override methods and how to call this base method. |
|
createNetwork()
|
Create a new LayoutNetwork of LayeredDigraphVertexes and LayeredDigraphEdges.
|
|
doLayout(coll)
|
Perform the layered digraph layout. More...
If there is no Layout.network, this calls makeNetwork to create a LayeredDigraphNetwork from the given collection of Parts. This removes any reflexive edges in the network, since they should be ignored. In order to influence a vertex's layer, you can override assignLayers. Finally this calls Layout.updateParts to commit the Node positions from the vertex positions. Layout.updateParts calls commitLayout within a transaction. |
- Methods borrowed from class Layout:
- copy, invalidateLayout, makeNetwork, updateParts
Constants Summary Details
Returns | Name | Description |
---|---|---|
<constant> {EnumValue} |
AggressiveLess
|
The faster, less aggressive, crossing reduction algorithm;
a valid value for LayeredDigraphLayout.aggressiveOption.
|
<constant> {EnumValue} |
AggressiveMore
|
The slower, more aggressive, crossing reduction algorithm,
a valid value for LayeredDigraphLayout.aggressiveOption.
|
<constant> {EnumValue} |
AggressiveNone
|
The fastest, but poorest, crossing reduction algorithm;
a valid value for LayeredDigraphLayout.aggressiveOption.
|
<constant> {EnumValue} |
CycleDepthFirst
|
Remove cycles using depth first cycle removal;
a valid value of LayeredDigraphLayout.cycleRemoveOption.
|
<constant> {EnumValue} |
CycleGreedy
|
Remove cycles using greedy cycle removal;
a valid value of LayeredDigraphLayout.cycleRemoveOption.
|
<constant> {EnumValue} |
InitDepthFirstIn
|
Initialize using depth first in initialization;
a valid value for LayeredDigraphLayout.initializeOption.
|
<constant> {EnumValue} |
InitDepthFirstOut
|
Initialize using depth first out initialization;
a valid value for LayeredDigraphLayout.initializeOption.
|
<constant> {EnumValue} |
InitNaive
|
Initialize using naive initialization;
a valid value for LayeredDigraphLayout.initializeOption.
|
<constant> {EnumValue} |
LayerLongestPathSink
|
Assign layers using longest path sink layering;
a valid value for LayeredDigraphLayout.layeringOption.
|
<constant> {EnumValue} |
LayerLongestPathSource
|
Assign layers using longest path source layering;
a valid value for LayeredDigraphLayout.layeringOption.
|
<constant> {EnumValue} |
LayerOptimalLinkLength
|
Assign layers using optimal link length layering;
A valid value for LayeredDigraphLayout.layeringOption.
|
<constant> {number} |
PackAll
|
Enable all options for the LayeredDigraphLayout.packOption property;
See also LayeredDigraphLayout.PackExpand, LayeredDigraphLayout.PackStraighten,
and LayeredDigraphLayout.PackMedian.
|
<constant> {number} |
PackExpand
|
This option gives more chances for the packing algorithm to improve the network,
but is very expensive in time for large networks;
a valid value for LayeredDigraphLayout.packOption.
|
<constant> {number} |
PackMedian
|
This option tries to have the packing algorithm center groups of nodes
based on their relationships with nodes in other layers,
a valid value for LayeredDigraphLayout.packOption.
|
<constant> {number} |
PackNone
|
Does minimal work in packing the nodes;
a valid value for LayeredDigraphLayout.packOption.
|
<constant> {number} |
PackStraighten
|
This option tries to have the packing algorithm straighten many of the
links that cross layers,
a valid value for LayeredDigraphLayout.packOption.
|