NormalizeGraphElementOrderStage normalizes the order of the elements within a graph to ensure the same order for multiple layout invocations.
Remarks
Among other factors, the results produced by layout algorithms usually depend on the order of the nodes and edges within a graph. Unfortunately, useful operations such as hiding or unhiding elements from a graph or simply invoking layout algorithms on a graph will have the potential side effect of changing that order.
With this ILayoutStage it is possible to establish a predefined order of nodes and edges within a graph to avoid non-deterministic layout behavior. Defining the order of nodes and edges is done by associating each node or edge in the graph with a IComparable value using a IDataProvider registered with the key NODE_COMPARABLE_DP_KEY or EDGE_COMPARABLE_DP_KEY, respectively.
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.NormalizeGraphElementOrderStage
Constructors
Creates a new NormalizeGraphElementOrderStage instance with an optional core layout algorithm.
Parameters
A map of options to pass to the method.
- coreLayouter - ILayoutAlgorithm
- The core layout algorithm.
Properties
Gets or sets the core layout algorithm that is wrapped by this stage.
Methods
Enforces the specified order of nodes and order of edges before invoking the core layout algorithm.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
Throws
- Exception({ name: 'InvalidOperationError' })
- if there is no IDataProvider registered for one of the keys NODE_COMPARABLE_DP_KEY and EDGE_COMPARABLE_DP_KEY
See Also
Implements
Invokes the layout process of the core layout algorithm.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Defined in
Constants
A data provider key for defining a (global) order for edges.
Domain | Edge | |
Values | IComparable | the value that describes the order of the edge in the graph |
A data provider key for defining a (global) order for nodes.
Domain | YNode | |
Values | IComparable | the value that describes the order of the node in the graph |
Static Methods
Assigns comparable values for each node and edge.
Remarks
The compared values are induced from the current ordering of the nodes and edges within the given graph.
This is a convenient method to fill the given IDataMaps which can then be registered with the graph with keys NODE_COMPARABLE_DP_KEY and EDGE_COMPARABLE_DP_KEY and used for several layout calculations.
Parameters
A map of options to pass to the method.
- graph - Graph
- the input graph
- comparableNodeMap - IDataMap
- the map that will be filled with comparable values for the nodes
Domain YNode Values IComparable the value that describes the order of the node in the graph - comparableEdgeMap - IDataMap
- the map that will be filled with comparable values for the edges
Domain Edge Values IComparable the value that describes the order of the edge in the graph