documentationfor yFiles for HTML 2.6

HierarchicalClustering

Partitions the graph into clusters using hierarchical clustering.

Inheritance Hierarchy
HierarchicalClustering

Remarks

Hierarchical clustering creates a hierarchy of clusters in a bottom-to-top approach based on some distance metric and linkage.

The clustering is performed using the agglomerative strategy i.e., a bottom-up approach according to which initially each node comprises its own cluster. At each step pairs of clusters are merged while moving up the hierarchy. The dissimilarity between clusters is determined based on the given linkage and the given node distances metric. The algorithm continues until all nodes belong to the same cluster.

Predefined metrics are available as constants on HierarchicalClustering:

Internally the HierarchicalClusteringResult stores a dendrogram which represents the result of the clustering algorithm as a binary tree structure. Based on the dendrogram the graph's nodes are partitioned into clusters according to either clusterCount or cutoff. Since both methods to compute the clusters only require the dendrogram, the HierarchicalClusteringResult offers methods to create a new clustering based on either criterion as long as either the graph or the subgraph specification did not change in between (which would require re-computing the dendrogram).

Other Clustering Algorithms

yFiles for HTML supports a number of other clustering algorithms:

Examples

Calculating hierarchic clusters of a graph
// prepare the hierarchical clustering algorithm
const algorithm = new HierarchicalClustering()
// run the algorithm
const result = algorithm.run(graph)

// highlight the nodes of the clusters with different styles
for (const node of graph.nodes) {
  const componentId = result.nodeClusterIds.get(node)
  graph.setStyle(node, clusterStyles.get(componentId))
}// prepare the hierarchical clustering algorithm
const algorithm = new HierarchicalClustering()
// run the algorithm
const result = algorithm.run(graph)

// highlight the nodes of the clusters with different styles
for (const node of graph.nodes) {
  const componentId = result.nodeClusterIds.get(node)
  graph.setStyle(node, clusterStyles.get(componentId)!)
}

Type Details

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

See Also

Constructors

Properties

Methods

Constants