This class realizes an algorithm that aggregates nodes in a LayoutGraph 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
Important: This class is designed for graphs of type LayoutGraph. To compute a node aggregation directly on a graph of type IGraph, please refer to NodeAggregation.
The algorithm can be started via method aggregate. 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 NodeAggregationInfo instances. More precisely, each node of the original graph is mapped to a unique NodeAggregationInfo instance. This mapping is stored in the IMapper<K,V> that is passed to method aggregate. Each NodeAggregationInfo has a reference to its parent which induces a directed tree structure. There is always exactly one NodeAggregationInfo 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 are taken from the layout property, so that it is important to specify proper coordinates and not use a structure-only graph instance.
Default Values of Properties
aggregationPolicy | STRUCTURAL
| |
maximumClusterSize | 10 | |
minimumClusterSize | 5 | |
nodesOnlyOnLeaves | true | Nodes are only mapped to leaves of the aggregation tree. |
nodeTypePolicy | IGNORE
| |
stopDuration | MAX_VALUE
| The algorithm runs unrestricted. |
Type Details
- yFiles module
- algorithms
Constructors
Creates a new LayoutGraphNodeAggregation 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.
- stopDuration - TimeSpan
- The duration that this algorithm should preferably run before stopping. This option sets the stopDuration property on the created object.
- nodeTypePolicy - NodeTypePolicy
- The policy for handling nodes of different type. This option sets the nodeTypePolicy 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.Property Value
Gets or sets the preferred maximum number of elements contained in a cluster.
Remarks
2
.Default Value
10
.Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the maximum cluster size is less than 2
See Also
Gets or sets the preferred minimum number of elements contained in a cluster.
Remarks
1
.Default Value
5
.Property Value
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.
Property Value
true
if nodes are only mapped to leaves, false
otherwiseGets or sets the policy for handling nodes of different type.
Default Value
IGNORE.Property Value
Gets or sets the duration that this algorithm should preferably run before stopping.
Remarks
Default Value
Property Value
Throws
- Exception({ name: 'ArgumentError' })
- if the specified duration has a negative value
Methods
Starts the node aggregation for the specified graph.
Remarks
aggregationResult
. Each NodeAggregationInfo has a reference to its parent which induces a directed tree structure. There is always exactly one NodeAggregationInfo without a parent that represents the root of the tree.Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
- aggregationResult - IMapper<LayoutNode,NodeAggregationInfo>
- stores a unique aggregation info associated with each node
Constants
A data key for specifying the (non-negative) weights of the edges.
Remarks
See Also
A data key for specifying the (non-negative) weights of the nodes.
Remarks
A data key for specifying the top-level nodes of the aggregation info.
Remarks
Assign true
to a node if the node should be a top-level node, or false
otherwise.
Top-level nodes are directly contained in the root cluster of the aggregation result or in direct children of the root if there are top-level nodes with different types (nodes of different type are not allowed to be directly contained in the same cluster). The only exception to this rules is if there are group nodes, because a group is a kind of user-specified cluster and, thus, a top-level node contained in a group is always placed in the cluster associated with that group.