C

HierarchicalClusteringDendrogram

Represents the result of a hierarchical clustering algorithm in the form of a binary tree structure.
Inheritance Hierarchy

Remarks

This class constructs a dendrogram using an agglomerative hierarchical clustering strategy, which follows a bottom-up approach. The process consists of the following steps:

  • Initially, at level 0, each node exists as its own cluster. In this stage, each node of the original graph (which is to be clustered) corresponds to a leaf node in the dendrogram, representing a node with no children.
  • As the process continues, pairs of clusters are merged step by step, ascending through the hierarchy. With each merge, a new dendrogram node is created. The dissimilarity value associated with the merging of two clusters can be retrieved via the getDissimilarityValue method. These dissimilarity values are non-decreasing, starting from zero, which corresponds to the dissimilarity at the leaf nodes.
  • The clustering process concludes when all nodes are combined into a single cluster, resulting in the root of the dendrogram. The root node can be accessed using the root property.

The resulting dendrogram is a directed binary tree, with the direction flowing from the root to the leaf nodes. You can traverse the dendrogram by starting from the root node and proceeding through its children using the getChildren method, continuing this process recursively through each subsequent level of the tree.

For any given dendrogram node, you can retrieve the set of nodes from the original graph that were grouped into that dendrogram node using the getClusterNodes method. This method returns an array of IEnumerable<T>, where each IEnumerable<T> contains the nodes from the original clusters that were merged to form the dendrogram node. For instance, if clusters C1 = {n1, n2} and C2 = {n3, n4} are merged to create a dendrogram node u, getClusterNodes will return two IEnumerable<T> collections, the first containing nodes n1, n2 and the second containing nodes n3, n4.

This class cannot be instantiated

See Also

API

hierarchicalClustering, hierarchicalClustering, hierarchicalClustering

Members

No filters for this type

Properties

Gets the number of levels this dendrogram has.
readonlyfinal

Property Value

the number of levels of this dendrogram
Gets the number of nodes in this dendrogram.
readonlyfinal

Property Value

the number of nodes in this dendrogram
Gets the root node of the dendrogram.
A dendrogram traversal can be implemented by starting from this node, then moving on to its children using method getChildren, and so on.
readonlyfinal

Property Value

the root node of the dendrogram

Methods

Returns an IEnumerable<T> with LayoutNode that contains the child nodes of the given parent node.
If the given node is a leaf node, the returned list will be empty.
final

Parameters

parent: LayoutNode
the parent node for which to retrieve the child nodes

Return Value

IEnumerable<LayoutNode>
the list of child nodes of the given parent node
Returns an array of IEnumerable<T> with LayoutNodes that contain the nodes of the original graph that are associated with the given dendrogram node.
Each such IEnumerable<T> with LayoutNode represents nodes that belong to the same cluster. For example, say that clusters C1 = {v1, v2} and C2 = {v3, v4} are merged, where {v1, v2, v3, v4} are nodes of the original graph. Say that dendrogram node u is created by this merging. Then, the cluster nodes of u will be returned as two IEnumerable<T> with LayoutNodes where the first contains nodes v1, v2 and the second v3, v4.
This method expects a LayoutNode that belongs to the dendrogram representation and not to the original graph.
final

Parameters

node: LayoutNode
the given dendrogram node

Return Value

IEnumerable<LayoutNode>
an array of IEnumerable<T> with LayoutNodes that contain the nodes of the original graph that are associated with the given dendrogram node
Returns the dissimilarity value associated with the given node of the dendrogram.
This method expects a LayoutNode that belongs to the dendrogram representation and not to the original graph.
final

Parameters

node: LayoutNode
the given dendrogram node

Return Value

number
the dissimilarity value associated with the given dendrogram node
Returns the level of the given node of the dendrogram.
This method expects a LayoutNode that belongs to the dendrogram representation and not to the original graph.
final

Parameters

node: LayoutNode
the given dendrogram node

Return Value

number
the level of the given dendrogram node
Returns the node of the dendrogram that belongs to the given level index.
If the given level index is greater than the number of levels, then this method will return null.
final

Parameters

level: number
the given level index

Return Value

LayoutNode
the node of the dendrogram that belongs to the given level index or null if there exists no level with the given index.

Throws

Exception ({ name: 'ArgumentError' })
if the given level is negative or greater than the nodeCount minus one.
Returns the node of the original graph that is mapped with the given leaf node of the dendrogram.
This method is meant to be called only for the leaf nodes of the dendrogram and returns null if the given node is not a leaf node.
final

Parameters

node: LayoutNode
The given leaf node

Return Value

LayoutNode
The node of the original graph that is mapped with the given leaf node or null if the given node is an inner dendrogram node
Returns whether or not the given dendrogram node is a leaf node.
A leaf node has no further children and represents a node of the original graph. The original node can be retrieved via getOriginalNode.
This method expects a LayoutNode that belongs to the dendrogram representation and not to the original graph.
final

Parameters

node: LayoutNode
a dendrogram node

Return Value

boolean
true if the given node is a leaf node, false otherwise