Packagecom.yworks.yfiles.layout.hierarchic
Classpublic class WeightedLayerer
InheritanceWeightedLayerer Inheritance YObject Inheritance Object
Implements OldLayerer, Layerer

This class implements the first phase of the hierarchic layouter. It first makes the directed graph acyclic. Then it assigns the layers such that edge weights are respected A weight defines a minimal distance between the two end points of an edge.



Public Properties
 PropertyDefined By
  maximalDuration : uint
Getter: Returns the time limit (in milliseconds) set for the algorithm.
WeightedLayerer
  weightedCycleRemoval : Boolean
Getter: Returns true if the edges that need to be reversed are determined using an edge weight based heuristic and false if a Depth First Search based approach should be used.
WeightedLayerer
Protected Properties
 PropertyDefined By
  key : Object
The key to access the weights.
WeightedLayerer
  weight : DataProvider
Provides the edge weights.
WeightedLayerer
Public Methods
 MethodDefined By
  
WeightedLayerer(init:Boolean = true)
Creates a new weighted layerer.
WeightedLayerer
  
WeightedLayerer
  
Assign the layers to the nodes.
WeightedLayerer
  
Assigns the layers to the nodes.
WeightedLayerer
  
assignNodeLayer(g:LayoutGraph, layer:NodeMap, reversedEdges:EdgeList):int
This method assigns the nodes in the graph to layers.
WeightedLayerer
  
This method assigns the nodes in the graph to layers.
WeightedLayerer
  
This method assigns the nodes in the graph to layers.
WeightedLayerer
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
WeightedLayerer
 Inherited
hashCode():int
YObject
  
makeDFSAcyclic(g:LayoutGraph, reversedEdges:EdgeList):void
Uses dfs to remove cycles from the graph.
WeightedLayerer
  
makeDFSAcyclic2(g:Graph, reversedEdges:EdgeList):void
Uses dfs to remove cycles from the graph.
WeightedLayerer
  
[static] Creates a new weighted layerer.
WeightedLayerer
  
[static] Creates a new weighted layerer.
WeightedLayerer
Protected Methods
 MethodDefined By
  
downShiftNodes(g:Graph, LAYER_KEY:NodeMap, maxLayer:int):void
Pushes the nodes down, drawings seems then to be nicer.
WeightedLayerer
  
getWeight(edge:Edge):Number
Returns the edge weight of the specified edge for use with the weight based cycle removal heuristic.
WeightedLayerer
  
Initializes this object.
WeightedLayerer
  
initWeightedLayerer2(k:Object):void
Initializes this object.
WeightedLayerer
Property Detail
keyproperty
protected var key:Object

The key to access the weights.

maximalDurationproperty 
maximalDuration:uint

Getter: Returns the time limit (in milliseconds) set for the algorithm.

Setter: Sets a preferred time limit (in milliseconds) for the algorithm. Note that restricting the maximal duration may result in a worse layout quality. Furthermore, the real runtime may exceed the maximal duration since the algorithm still have to find a valid solution.


Implementation
    public function get maximalDuration():uint
    public function set maximalDuration(value:uint):void
weightproperty 
protected var weight:DataProvider

Provides the edge weights.

weightedCycleRemovalproperty 
weightedCycleRemoval:Boolean

Getter: Returns true if the edges that need to be reversed are determined using an edge weight based heuristic and false if a Depth First Search based approach should be used. The weight based approach may result in fewer reversed edges (especially for cases with many multi edges) whereas the DFS based approach is likely to be faster.

Defaults to false.

Setter: Specifies if the edges that need to be reversed are determined using an edge weight based heuristic or using a Depth First Search based approach. The weight based approach may result in fewer reversed edges (especially for cases with many multi edges) whereas the DFS based approach is likely to be faster.

By default, the DFS based approach is used.


Implementation
    public function get weightedCycleRemoval():Boolean
    public function set weightedCycleRemoval(value:Boolean):void
Constructor Detail
WeightedLayerer()Constructor
public function WeightedLayerer(init:Boolean = true)

Creates a new weighted layerer.

Parameters
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
assignLayers()method
public function assignLayers(graph:LayoutGraph, layers:Layers, ldp:LayoutDataProvider):void

Parameters

graph:LayoutGraph
 
layers:Layers
 
ldp:LayoutDataProvider

assignLayersFast()method 
public function assignLayersFast(g:Graph, layer:NodeMap):int

Assign the layers to the nodes.

Parameters

g:Graph
 
layer:NodeMap

Returns
int
assignLayersToNodes()method 
public function assignLayersToNodes(g:Graph, layer:NodeMap):int

Assigns the layers to the nodes.

Parameters

g:Graph
 
layer:NodeMap

Returns
int
assignNodeLayer()method 
public function assignNodeLayer(g:LayoutGraph, layer:NodeMap, reversedEdges:EdgeList):int

This method assigns the nodes in the graph to layers.

Postcondition Forall (v,w) in E: layer(v) < layer(w)

Parameters

g:LayoutGraph — the graph for which the layers are determined.
 
layer:NodeMap — here the layers are stored
 
reversedEdges:EdgeList — here the edges are stored which had been reversed.

Returns
int — the number of layers
assignNodeLayerForGraph()method 
public function assignNodeLayerForGraph(g:Graph, layer:NodeMap, reversedEdges:EdgeList, w:DataProvider):int

This method assigns the nodes in the graph to layers.

Postcondition Forall (v,w) in E: layer(v) < layer(w)

Parameters

g:Graph — the graph for which the layers are determined.
 
layer:NodeMap — here the layers are stored
 
reversedEdges:EdgeList — here the edges are stored which had been reversed.
 
w:DataProvider

Returns
int — the number of layers
assignNodeLayerWithWeights()method 
public function assignNodeLayerWithWeights(g:LayoutGraph, layer:NodeMap, reversedEdges:EdgeList, w:DataProvider):int

This method assigns the nodes in the graph to layers.

Postcondition Forall (v,w) in E: layer(v) < layer(w)

Parameters

g:LayoutGraph — the graph for which the layers are determined.
 
layer:NodeMap — here the layers are stored
 
reversedEdges:EdgeList — here the edges are stored which had been reversed.
 
w:DataProvider

Returns
int — the number of layers
downShiftNodes()method 
protected function downShiftNodes(g:Graph, LAYER_KEY:NodeMap, maxLayer:int):void

Pushes the nodes down, drawings seems then to be nicer.

Parameters

g:Graph
 
LAYER_KEY:NodeMap
 
maxLayer:int

getClass()method 
override public function getClass():Class

Returns
Class
getWeight()method 
protected function getWeight(edge:Edge):Number

Returns the edge weight of the specified edge for use with the weight based cycle removal heuristic.

By default, all edges are considered to have weight 1.0.

Parameters

edge:Edge — the edge whose weight is returned.

Returns
Number — the edge weight of the specified edge.

See also

initWeightedLayerer1()method 
protected final function initWeightedLayerer1():void

Initializes this object. See the documentation of the corresponding factory method newWeightedLayerer1() for details.

See also

initWeightedLayerer2()method 
protected final function initWeightedLayerer2(k:Object):void

Initializes this object. See the documentation of the corresponding factory method newWeightedLayerer2() for details.

Parameters

k:Object

See also

makeDFSAcyclic()method 
public function makeDFSAcyclic(g:LayoutGraph, reversedEdges:EdgeList):void

Uses dfs to remove cycles from the graph.

Parameters

g:LayoutGraph
 
reversedEdges:EdgeList

makeDFSAcyclic2()method 
public function makeDFSAcyclic2(g:Graph, reversedEdges:EdgeList):void

Uses dfs to remove cycles from the graph.

Parameters

g:Graph
 
reversedEdges:EdgeList

newWeightedLayerer1()method 
public static function newWeightedLayerer1():WeightedLayerer

Creates a new weighted layerer.

Returns
WeightedLayerer
newWeightedLayerer2()method 
public static function newWeightedLayerer2(k:Object):WeightedLayerer

Creates a new weighted layerer.

Parameters

k:Object — the key to access the weights.

Returns
WeightedLayerer