Cluster trees

Each hierarchical matrix is defined by two cluster trees, corresponding to rows and columns of matrix. Row and column cluster trees are hierarchical, root nodes correspond to all rows and columns correspondingly.

class h2tools.cluster_tree.ClusterTree(data, block_size)

Stores cluster tree as lists of parents and children.

Parameters:

data : Python object

Data, that is required to be clustered with cluster tree.

block_size : integer

Maximum size of leaf-node (number of objects, corresponding to leaf-node) with near-field interactions.

Attributes

block_size (integer) Maximum size of leaf-node (number of objects, corresponding to leaf-node) with near-field interactions.
data (Python object) Data, that is required to be clustered with cluster tree.
index (instance of SmartIndex) Indexes of clusters. For i-th node of cluster tree, index[i] is a numpy.ndarray(ndim=1,dtype=numpy.uint64), containing indexes of corresponding data objects.
parent (list of integers) List of parent nodes (defined by its number, -1 for root-node).
child (list of lists of integers) For i-th node of cluster tree, child[i] is a list of child-nodes (defined by its number).
leaf (list of integers) List of leaf-nodes, defined by their numbers.
level (list of integers) For l level of depth of cluster tree, all corresponding nodes have numbers from level[l] (incslusively) to level[l+1] (exclusively).
num_levels (integer) Number of levels of depth of cluster tree.
num_leaves (integer) Number of total leaf-nodes in cluster tree.
num_nodes (integer) Number of total nodes in cluster tree.
copy()

Reserved for copy function of tree object.

divide(key)

Divides cluster with given ID into sublcusters.

Fills every required field (such as list of parents, children) and so on.

draw(key=0)

Reserved for drawing tree with accent on node key.

static fromfile(fname)

Reserved for function, that reads tree information from file.

is_consistent()

Check inner structure of cluster tree.

Checks cluster for consistency (child-parent bonds, objects of each cluster node are next to each other). Currently, no need to use this function.

is_far(i, other_tree, j)

Checks if two clusters are far or close to each other.

This check is done only with auxiliary information about each cluster (which is computed by data.cluster_auxiliary_data_func).

tofile(fname)

Reserved for function, that writes tree information to file.