This class implements the layering phase of the HierarchicLayout (i.e., the assignment of the nodes to layers).
Remarks
It first makes the directed graph acyclic. Then, it assigns the layers such that edge weights are respected. A weight defines a minimum distance between the two end points of an edge.
Default Values of Properties
maximumDuration | <code>0x7FFFFFFF</code> | The layout algorithm runs unrestricted. |
weightedCycleRemoval | false | The DFS based approach is used. |
Type Details
- yfiles module
- layout-hierarchic
- yfiles-umd modules
- layout-familytree, layout-hierarchic, layout-radial, layout
- Legacy UMD name
- yfiles.hierarchic.WeightedLayerer
See Also
Constructors
Creates an instance of WeightedLayerer with the given key that provides access to the IDataProvider that holds the edge weights and unlimited maximum duration for the WeightedLayerer.
Parameters
A map of options to pass to the method.
- key - Object
- the key to access the IDataProvider that holds the edge weights
Properties
Gets or sets the time limit in milliseconds set for the layout algorithm.
Remarks
0
.Default Value
<code>0x7FFFFFFF</code>
.The layout algorithm runs unrestricted.
Throws
- Exception({ name: 'ArgumentError' })
- if the maximum duration is negative
Gets or sets whether or not the edges that need to be reversed are determined using an edge weight based heuristic or using a depth first search based approach.
Remarks
Default Value
false
.The DFS based approach is used.
Methods
Assigns all nodes of the graph to layers and adds them to the ILayers instance.
Parameters
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
Assigns all nodes of the graph to layers.
Postconditions
- For all
(v,w)
inE: layer(v) < layer(w)
Parameters
A map of options to pass to the method.
- graph - Graph
- the graph for which the layers are determined
- layerID - INodeMap
- the INodeMap that will be filled by the layout algorithm and returns a zero-based layer index for each node
Domain YNode Values number a zero-based layer index for each node
Returns
- ↪number
- the number of layers
Assigns all nodes of the graph to layers.
Postconditions
- For all
(v,w)
inE: layer(v) < layer(w)
Parameters
A map of options to pass to the method.
- graph - Graph
- the graph for which the layers are determined
- layerID - INodeMap
- the INodeMap that will be filled by the layout algorithm and returns the zero-based index of the layer to which each node belongs
Domain YNode Values number the zero-based index of the layer to which each node belongs
Returns
- ↪number
- the number of layers
assignNodeLayerWithDataProvider
(graph: LayoutGraph, layerID: INodeMap, reversedEdges: EdgeList, weight: IDataProvider) : numberAssigns all nodes of the graph to layers.
Postconditions
- For all
(v,w)
inE: layer(v) < layer(w)
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the graph for which the layers are determined
- layerID - INodeMap
- the INodeMap that will be filled by the layout algorithm and returns a zero-based layer index for each node
Domain YNode Values number a zero-based layer index for each node - reversedEdges - EdgeList
- an EdgeList containing the edges which had been reversed
- weight - IDataProvider
- the IDataProvider that returns an integer value (weight) for each edge
Domain Edge Values number a non-negative value representing the weight of each edge
Returns
- ↪number
- the number of layers
Returns the edge weight of the given edge using the weight based cycle removal heuristic.
Remarks
By default, all edges are considered to have weight 1.0
.
It may be overridden if non-uniform weights are desired.
Parameters
A map of options to pass to the method.
- edge - Edge
- given edge
Returns
- ↪number
- the edge weight of the specified edge
See Also
Fields
The key to access the IDataProvider that holds the edge weights.
Remarks
This is a IDataProvider that holds for each Edge an integer value representing its weight.