This layering algorithm implementation assigns nodes to layers given a mapping of nodes to layer IDs.
Remarks
The layer IDs are given by a IDataProvider that returns the integer layer ID of each node of the graph. Nodes with the same ID are in the same layer while the layers are sorted according to their IDs such that the smallest ID represents the top layer.
Type Details
- yfiles module
- layout-hierarchic
- yfiles-umd modules
- layout-familytree, layout-hierarchic, layout-radial, layout
- Legacy UMD name
- yfiles.hierarchic.GivenLayersLayerer
See Also
Constructors
Creates an instance of GivenLayersLayerer.
Methods
Assigns all nodes of the graph to layers and adds them to the ILayers instance.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- layers - ILayers
- the ILayers instance that will be filled with the results of the calculation
- ldp - ILayoutDataProvider
- the ILayoutDataProvider used for querying information about the nodes and edges
See Also
Implements
Convenience method that removes empty layers and ensures that the smallest layer has value 0
.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- graph - Graph
- the graph
- layerId - IDataProvider
- the IDataProvider that returns an integer value (layer) for each node; the first layer has the number
0
Domain YNode Values number a non-negative value representing the layer of each node - normalizedLayerId - IDataAcceptor
- the IDataAcceptor that will be filled by the layout algorithm and holds an integer value (layer ID after normalization) for each node
Domain YNode Values number a non-negative value representing the layer ID after normalization of each node
Returns
- ↪number
- the number of layers after the removal of empty layers
Constants
A data provider key for storing the layer IDs.
Remarks
This IDataProvider stores for each node the layer ID to which it belongs. Nodes with the same ID are in the same layer while the layers are sorted according to their IDs such that the smallest ID represents the top layer.
Domain | YNode | |
Values | number | a non-negative integer value representing the layer ID of each node |