This layering algorithm implementation assigns nodes to layers given a mapping of nodes to layer indices.
Remarks
The indices are given by an IMapper<K,V> that returns the integer index of each node of the graph. The nodes are assigned to layers in the following way:
- Nodes with the same index are placed in the same layer.
- A node with a smaller index is placed in a layer above that of a node with a larger layer index ("above" with respect to the given LayoutOrientation, i.e., on a smaller y-coordinate for orientation top-to-bottom).
- The given layer indices are normalized such that there are no empty layers and the smallest layer has value
0
.
Type Details
- yFiles module
- algorithms
Constructors
Creates an instance of GivenLayersAssigner.
Methods
Assigns all nodes of the graph to layers and adds them to the layers instance in the given layoutContext
.
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
- layoutContext - HierarchicalLayoutContext
- The HierarchicalLayoutContext used for querying information about the nodes and edges
See Also
Implements
Constants
A data key for storing the layer indices.
Remarks
The associated IMapper<K,V> stores an integer index for each node of the graph. The nodes are assigned to layers in the following way:
- Nodes with the same index are placed in the same layer.
- A node with a smaller index is placed in a layer above that of a node with a larger layer index ("above" with respect to the given LayoutOrientation, i.e., on a smaller y-coordinate for orientation top-to-bottom).
- The given layer indices are normalized such that there are no empty layers and the smallest layer has value
0
.
See Also
It is recommended to use givenLayersIndices instead, which provides a simpler and more convenient way for storing the layer indices.