This class implements the layering phase of the HierarchicalLayout (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
stopDuration | MAX_VALUE
| The layout algorithm runs unrestricted. |
weightedCycleRemoval | false | The DFS-based approach is used. |
Type Details
- yFiles module
- algorithms
Constructors
Creates an instance of WeightedLayerAssigner with unlimited stop duration and the given key that provides access to the IMapper<K,V> that holds the edge weights.
Parameters
A map of options to pass to the method.
- key - EdgeDataKey<number>
- The key to access the IMapper<K,V> that holds the edge weights. If omitted, edge weights are considered to be uniform.
- weightedCycleRemoval - boolean
- 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. This option sets the weightedCycleRemoval property on the created object.
- stopDuration - TimeSpan
- The time limit set for the layout algorithm. This option sets the stopDuration property on the created object.
Properties
Gets or sets the time limit set for the layout algorithm.
Remarks
Default Value
Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the stop 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.
Property Value
true
if an edge weight-based heuristic is used; false
if a DFS-based approach is usedMethods
Assigns all nodes of the graph to layers and adds them to the layers in the given layoutContext
.
Parameters
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
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 - LayoutEdge
- given edge
Returns
- ↪number
- the edge weight of the specified edge