@graphty/algorithms / index / HierarchicalResult
Interface: HierarchicalResult ​
Defined in: indexed/hierarchical.ts:26
The dendrogram of an agglomerative clustering. Clusters 0 .. nodeCount - 1 are the nodes themselves; merge k creates cluster nodeCount + k from left[k] and right[k].
Properties ​
distance ​
readonlydistance:Float64Array
Defined in: indexed/hierarchical.ts:34
Linkage distance of every merge.
height ​
readonlyheight:Uint32Array
Defined in: indexed/hierarchical.ts:36
Height of every cluster: 0 for a node, one more than its taller child for a merge.
left ​
readonlyleft:Uint32Array
Defined in: indexed/hierarchical.ts:30
First cluster of every merge.
nodeCount ​
readonlynodeCount:number
Defined in: indexed/hierarchical.ts:28
The node count the clustering ran over.
right ​
readonlyright:Uint32Array
Defined in: indexed/hierarchical.ts:32
Second cluster of every merge.
roots ​
readonlyroots:Uint32Array
Defined in: indexed/hierarchical.ts:42
The clusters left unmerged, in the order the legacy function lists its forest's trees: one entry (the last merge) when every pair of nodes could be linked, one per disconnected part otherwise, and none for an empty snapshot.
Methods ​
cut() ​
cut(
height):Uint32Array<ArrayBufferLike>[]
Defined in: indexed/hierarchical.ts:54
Cut every root at height: a cluster no taller than height is kept whole, a taller one is replaced by its two children. The clusters come in left-to-right order, root by root.
Parameters ​
height ​
number
The cut height
Returns ​
Uint32Array<ArrayBufferLike>[]
cutAt() ​
cutAt(
by):LabelResult
Defined in: indexed/hierarchical.ts:61
The flat partition after the first merges: with clusters: k, the first nodeCount - k merges, so exactly k clusters remain; with distance: d, the merges in order up to the first whose distance exceeds d.
Parameters ​
by ​
{ clusters: number; } | { distance: number; }
The cluster count, from roots.length to nodeCount, or the largest merge distance to apply
Returns ​
Throws ​
RangeError (code E_BAD_OPTION) for a cluster count outside that range or a NaN distance
members() ​
members(
cluster):Uint32Array
Defined in: indexed/hierarchical.ts:48
The node indices of a cluster, left subtree first -- the order the legacy function's member Sets iterate in.
Parameters ​
cluster ​
number
A cluster index
Returns ​
Uint32Array