This class realizes an algorithm that aggregates nodes and creates a hierarchical clustering structure subject to user-specified constraints like the type of nodes as well as the preferred minimum and maximum size of a cluster.
Remarks
The result of the aggregation can be used to (interactively) visualize parts of large graphs.
Note that the resulting clustering structure corresponds to a directed rooted tree which we encode by means of a set of AggregationInfo instances. More precisely, each node of the original graph is mapped to a unique AggregationInfo instance. This mapping is stored in the INodeMap that is passed to method aggregate. Each AggregationInfo has a reference to its parent which induces a directed tree structure. There is always exactly one AggregationInfo without a parent that represents the root of the tree. Property nodesOnlyOnLeaves allows to specify whether nodes are only mapped to leaves of the tree structure or if they can also be mapped to inner nodes.
Property aggregationPolicy allows to specify whether the algorithm should consider structural properties (i.e., considering the connectivity) for the aggregation or geometric properties (i.e., the distance between nodes). For the second policy, the coordinates of the nodes have to be specified by the user by means of a IDataProvider registered with key NODE_CENTER_DP_KEY.
Default Values of Properties
aggregationPolicy | STRUCTURAL
| |
maximumClusterSize | 10 | |
maximumDuration | <code>0x7FFFFFFF</code> | The algorithm runs unrestricted. |
minimumClusterSize | 5 | |
nodesOnlyOnLeaves | true | Nodes are only mapped to leaves of the aggregation tree. |
nodeTypeHandlingPolicy | IGNORE
|
Type Details
- yfiles module
- algorithms
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.algorithms.NodeAggregation
Constructors
Creates a new NodeAggregationAlgorithm instance with default settings.
Parameters
A map of options to pass to the method.
- nodesOnlyOnLeaves - boolean
Whether or not all original nodes are only mapped to leaves of the directed rooted aggregation tree that represents the hierarchical clustering structure. This option sets the nodesOnlyOnLeaves property on the created object.
- maximumDuration - number
The maximum duration in milliseconds that this layout algorithm is allowed to run. This option sets the maximumDuration property on the created object.
- nodeTypeHandlingPolicy - NodeAggregationNodeTypeHandlingPolicy
The policy for handling nodes of different type. This option sets the nodeTypeHandlingPolicy property on the created object.
- aggregationPolicy - NodeAggregationPolicy
The policy applied for determining the clusters. This option sets the aggregationPolicy property on the created object.
- minimumClusterSize - number
The preferred minimum number of elements contained in a cluster. This option sets the minimumClusterSize property on the created object.
- maximumClusterSize - number
The preferred maximum number of elements contained in a cluster. This option sets the maximumClusterSize property on the created object.
Properties
Gets or sets the policy applied for determining the clusters.
Default Value
STRUCTURAL.Throws
- Exception({ name: 'ArgumentError' })
- if an unknown policy is provided
Gets or sets the preferred maximum number of elements contained in a cluster.
Remarks
2
.Default Value
10
.Throws
- Exception({ name: 'ArgumentError' })
- if the maximum cluster size is less than 2
See Also
Gets or sets the maximum duration in milliseconds that this layout algorithm is allowed to run.
Remarks
Default Value
<code>0x7FFFFFFF</code>
.The algorithm runs unrestricted.
Throws
- Exception({ name: 'ArgumentError' })
- if the specified duration has a negative value
Gets or sets the preferred minimum number of elements contained in a cluster.
Remarks
1
.Default Value
5
.Throws
- Exception({ name: 'ArgumentError' })
- if the minimum cluster size is less than 1
See Also
Gets or sets whether or not all original nodes are only mapped to leaves of the directed rooted aggregation tree that represents the hierarchical clustering structure.
Remarks
Default Value
true
.Nodes are only mapped to leaves of the aggregation tree.
Methods
Starts the node aggregation for the specified graph.
Remarks
aggregationResult
. Each AggregationInfo has a reference to its parent which induces a directed tree structure. There is always exactly one AggregationInfo without a parent that represents the root of the tree.Parameters
A map of options to pass to the method.
- graph - Graph
- the input graph
- aggregationResult - INodeMap
- stores the result of the aggregation
Domain YNode Values AggregationInfo the unique aggregation info associated with a node
Constants
A data provider key for specifying the directedness of edges.
Remarks
- A directedness value of
1
indicates that the edge is considered to be directed from source to target. - A directedness value of
-1
indicates that the edge is considered to be directed from target to source. - A directedness value of
0
indicates that the edge is considered to be undirected.
Domain | Edge | the edges of the input graph |
Values | number | the directedness of an edge |
0.0
.A data provider key for specifying the (non-negative) weights of the edges.
Remarks
Domain | Edge | the edges of the input graph |
Values | number | the non-negative weight of the edge |
See Also
A data provider key for specifying the coordinates of the nodes.
Remarks
Domain | YNode | the nodes of the input graph |
Values | YPoint | the center coordinate of a node |
See Also
A data provider key for specifying the type of the nodes.
Remarks
Domain | YNode | the nodes of the input graph |
Values | Object | the type of the node |
See Also
A data provider key for specifying the (non-negative) weights of the nodes.
Remarks
Domain | YNode | the nodes of the input graph |
Values | number | the non-negative weight of a node |
A data provider key for specifying the top-level nodes of the aggregation info.
Remarks
Domain | YNode | the nodes of the input graph |
Values | boolean | true if the node should be a top-level node, false otherwise |