apaGraph.Edges.FromClusterLabels(Labels)
=apaGraph.Edges.FromClusterLabels(Labels)Result
Converts cluster labels into the edge list of a tree. Returns one row per edge with the parent node index, the child node index and the edge weight, which is always 1. The result can be drawn with apaTree.Layout.
Syntax
Labels: n x 1 vector of cluster labels, e.g. from apaClustering.kMeans, or n x L matrix of nested groupings ordered from coarse to fine, e.g. from apaClustering.kMeans.Bisecting with DoShowStructureOtherwiseFinalGrouping = TRUE; columns containing only #N/A are ignored
Algorithm
Every final cluster (the groups of the last column) becomes a node with its objects as children. For a vector, a root node is added above the clusters. For a matrix, each column must be a refinement of the previous one; a cluster that is divided between two columns becomes a parent node of its parts, while a cluster that is not divided remains the same node. If the first column contains more than one group, a root node is added above these groups.
Remarks
Node numbering follows the hierarchical clustering functions: the objects are numbered 1 to n in the order of the rows of Labels, the final clusters n + 1 to n + k in ascending order of their labels, followed by the higher-level nodes, and the root has the highest number. Since the node numbers are consecutive, row i of the output of apaTree.Layout contains the coordinates of node i.
The labels can be any numbers; they only serve to identify the groups. An error is returned if the groupings are not nested.
