Packagecom.yworks.yfiles.layout.hierarchic
Classpublic class BFSLayerer
InheritanceBFSLayerer Inheritance YObject Inheritance Object
Implements OldLayerer, Layerer

Layerer that uses a breadth first search to assign layers to the nodes. The nodes of the first layer can be freely chosen (see CORE_NODES). The nodes belonging to a subsequent layer are determined as follows: Add all yet unassigned nodes to the new layer that are connected to nodes already assigned.

As a consequence all connected nodes will be at most one layer apart. Also, edges between nodes that belong to the same layer are possible.

See also

CORE_NODES


Public Methods
 MethodDefined By
  
BFSLayerer(init:Boolean = true)
BFSLayerer
  
BFSLayerer
  
assignNodeLayer(graph:LayoutGraph, layer:NodeMap, reversedEdges:EdgeList):int
This method assigns the nodes in the graph to layers.
BFSLayerer
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
BFSLayerer
 Inherited
hashCode():int
YObject
  
[static]
BFSLayerer
Protected Methods
 MethodDefined By
  
Initializes this object.
BFSLayerer
Public Constants
 ConstantDefined By
  CORE_NODES : Object
[static] The data provider key used to look up the core nodes of the bfs layering.
BFSLayerer
Constructor Detail
BFSLayerer()Constructor
public function BFSLayerer(init:Boolean = true)

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

assignNodeLayer()method 
public function assignNodeLayer(graph: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

graph: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
getClass()method 
override public function getClass():Class

Returns
Class
initBFSLayerer()method 
protected final function initBFSLayerer():void

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

See also

newBFSLayerer()method 
public static function newBFSLayerer():BFSLayerer

Returns
BFSLayerer
Constant Detail
CORE_NODESConstant
public static const CORE_NODES:Object

The data provider key used to look up the core nodes of the bfs layering. The BFSLayerer will try to retrieve a data provider from the graph to be layered with this key. The looked up data provider should provide boolean values for the nodes of that graph. The boolean value signals whether a node is to be placed in the first layer or not.

If the are no nodes marked as core nodes then nodes with indegree 0 are considered to be core nodes.