documentationfor yFiles for HTML 2.6

NodeAggregation

Aggregates the nodes of a given graph and creates a hierarchical clustering structure subject to user-specified constraints.

Inheritance Hierarchy
NodeAggregation

Remarks

The result is subject to user-specified constraints like the type of nodes as well as the preferred minimum and maximum size of a cluster. 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 is encoded by means of a set of NodeAggregate instances. More precisely, each node of the original graph is mapped to a unique NodeAggregate instance. Each NodeAggregate has a reference to its parent which induces a directed tree structure.There is always exactly one NodeAggregate without a parent that represents the root of the tree.

aggregation specifies whether the algorithm should consider structural properties (i.e., considering the connectivity) for the aggregation or geometric properties (i.e., the distance between nodes).

Examples

// prepare the node aggregation algorithm
const algorithm = new NodeAggregation({
  // group according to the node types which are specified in the node's tag
  nodeTypeHandling:
    NodeAggregationNodeTypeHandlingPolicy.SEPARATE_AT_ROOT,
  nodeTypes: (node) => node.tag,
  // determine substructures according to the graph structure, not the geometry
  aggregation: NodeAggregationPolicy.STRUCTURAL
})
// run the algorithm
const result = algorithm.run(graph)

// highlight the nodes of the aggregates with different styles
// group by the top level aggregates
let index = 0
for (const aggregate of result.root.children) {
  for (const node of aggregate.nodes) {
    graph.setStyle(node, clusterStyles.get(index))
  }
  index++
}// prepare the node aggregation algorithm
const algorithm = new NodeAggregation({
  // group according to the node types which are specified in the node's tag
  nodeTypeHandling:
    NodeAggregationNodeTypeHandlingPolicy.SEPARATE_AT_ROOT,
  nodeTypes: (node: INode): any => node.tag,
  // determine substructures according to the graph structure, not the geometry
  aggregation: NodeAggregationPolicy.STRUCTURAL
})
// run the algorithm
const result = algorithm.run(graph)

// highlight the nodes of the aggregates with different styles
// group by the top level aggregates
let index = 0
for (const aggregate of result.root.children) {
  for (const node of aggregate.nodes) {
    graph.setStyle(node, clusterStyles.get(index)!)
  }
  index++
}

Type Details

yfiles module
view-layout-bridge
yfiles-umd modules
view-layout-bridge
Legacy UMD name
yfiles.analysis.NodeAggregation

See Also

Constructors

Properties

Methods