Represents clusters in the graph and the dendrogram as computed by HierarchicalClustering.
Remarks
The dendrogram remains valid for the chosen metric and HierarchicalClusteringLinkage as long as the graph did not change in between. This can be used to efficiently cluster the same graph again with a different number of clusters or a different cut-off value for dissimilarity using either changeClusterCount or changeCutoff.
This class cannot be instantiated
Type Details
- yFiles module
- view-layout-bridge
Properties
Gets a collection of all clusters in the graph.
Gets the root of the dendrogram which is used internally to generate the clusters.
Remarks
Initially each node comprises its own cluster. At each step of the clustering algorithm, two clusters are merged together until all nodes belong to the same cluster. The tree which is generated this way is stored as a dendrogram. The dendrogram's leaves thus represent clusters that each contain a single node. The dendrogram's root represents a cluster that contains every node of the graph.
The actual clusters can be calculated for a cluster count using changeClusterCount or for a cut-off value using changeCutoff.
The dendrogram's root can be null
if the original graph was empty.
See Also
Gets a mapping from each node to its cluster ID.
Remarks
-1
.Gets a mapping from each node to its cluster.
Methods
Creates a new HierarchicalClusteringResult with the given number of clusters.
Parameters
A map of options to pass to the method.
- clusterCount - number
- The cluster count. Must be positive; if it's greater than the number of nodes in the graph, the number of clusters in the result is equal to the number of nodes.
Returns
- ↪HierarchicalClusteringResult
- A new HierarchicalClusteringResult with the same dendrogramRoot and clusters calculated based on that dendrogram and the
clusterCount
.
Creates a new HierarchicalClusteringResult with clusters based on the given cutoff value.
Parameters
A map of options to pass to the method.
- cutoff - number
- The cutoff value for the clusters' dissimilarity.
Returns
- ↪HierarchicalClusteringResult
- A new HierarchicalClusteringResult with the same dendrogramRoot and clusters calculated based on that dendrogram and
cutoff
.
Gets the representative of node
in the dendrogram.
Remarks
The representative of node
is one of the dendrogram's leaves which represents the cluster that only contains the node
.
If a subgraph is specified, this method returns null
if node
is not part of the subgraph.
Parameters
A map of options to pass to the method.
- node - INode
- The node for which to retrieve the representative in the dendrogram.
Returns
- ↪DendrogramNode?
- The representative of
node
in the dendrogram.