public class BFSLayerer extends Object implements ILayerer
BFSLayerer
uses a breadth first search for assigning layers to the nodes.
The nodes of the first layer can be freely selected (see
CORE_NODES_DPKEY
). The nodes that belong 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.
Modifier and Type | Field and Description |
---|---|
static NodeDpKey<Boolean> |
CORE_NODES_DPKEY
A
DataProvider key for identifying the core nodes of the BFS layering.
|
Constructor and Description |
---|
BFSLayerer()
Creates an instance of
BFSLayerer . |
Modifier and Type | Method and Description |
---|---|
void |
assignLayers(LayoutGraph graph,
ILayers layers,
ILayoutDataProvider ldp)
Assigns all nodes of the graph to layers and adds them to the
ILayers instance. |
int |
assignNodeLayer(LayoutGraph graph,
INodeMap layerID,
EdgeList reversedEdges)
Assigns the nodes of the graph to layers.
|
public static final NodeDpKey<Boolean> CORE_NODES_DPKEY
DataProvider
key for identifying the core nodes of the BFS layering.
The IDataProvider
registered with this key should provide boolean values for the nodes of the graph. The boolean
value determines whether or not a node is to be placed in the first layer. If there are no nodes marked as core nodes,
then nodes with in-degree 0
are considered to be the core nodes.
public BFSLayerer()
BFSLayerer
.public void assignLayers(LayoutGraph graph, ILayers layers, ILayoutDataProvider ldp)
ILayers
instance.assignLayers
in interface ILayerer
graph
- the input graphlayers
- the ILayers
instance that will be filled with the results of the calculationldp
- the ILayoutDataProvider
used for query information about the nodes and edgesILayers.insert(com.yworks.yfiles.layout.hierarchic.LayerType, int)
,
ILayer.add(com.yworks.yfiles.algorithms.Node)
public int assignNodeLayer(LayoutGraph graph, INodeMap layerID, EdgeList reversedEdges)
(v,w)
in E: layer(v) < layer(w)
.graph
- the given graphlayerID
- the INodeMap
that will be filled by the layout algorithm and returns the zero-based index of the layer to which
each node belongsreversedEdges
- an EdgeList
containing the edges which had been reversed