The Dendrogrammer Code Documentation

dendrogrammer  Dendrogrammer version 1.0.3

The Dendrogrammer > dendrogrammer > ClusterTree

Class ClusterTree

The ClusterTree class holds a tree of clusters. Actually it is one root node leading to all the other nodes in the tree. The tree is a single root node which is the overall ancestor of all nodes in the tree. Each node is an instance of the ClusterNode class. Each node represents a cluster from the ClusterTable. The root node is the cluster that has the highest merge height.
Each node has
- nType: either leaf 2, cluster 1, or root 0
- childA: one of the two child nodes (that are other node objects)
- childB: see above
- xHt: the height of the cluster OR zero for a leaf
- parent: a parent node (another node object)
- yPos: for a leaf this is the numbered leaf slot on the leaf axis (y axis). For a cluster or the root this is the point midway (in y) between the yPos of its two child nodes.
For the purpose of the algorithm the leaf axis is the y axis because the default orientation for the tree is on its side with root at the right and leaves at the left arranged down the y axis.
- element: a visible drawn graphical object representing the cluster on the graph
- bBox: a bounding box, a transparent graphical object representing the live area on the graph associated with the cluster
- rowIndex: the index of the row on the clusterTable from which it was generated
- idNo: the number given it by MATLAB in creating the clustering data
e.g. in our example data the cluster on row 0 (Item A =1, ItemB=6 which are two leaves are part of the first cluster. 5 rows (0 to 4) => 6 leafs => first cluster is no.7 so the idNo for that cluster will be 7.

The ClsterTree constructor calls the new ClusterNode constructor method on the root node which in turn calls the ClusterNode grow() method which recursively calls itself to build the tree from the data in ClusterTable table. The constructor also sets the graph yPos for each node.

Important ClusterTree attribute:
this.root. However, this.root is accessed via the getRoot() method.

Constructor

ClusterTree ( cTableIn , stylesIn )
Parameters:
cTableIn <ClusterTable> the instance of ClusterTable containing the input data.
stylesIn <style object> carries the style info for local access

Methods

getRoot

node getRoot ( )
Returns: node
the root node in the tree

setClusterY

boolean setClusterY ( node )
Recursively traverses the tree setting the yPos attribute. Based on the yPos of the leaf nodes. The yPos for each leaf is already set (it is the sproutCount property) The yPos for a cluster is half way between the childA.yPos and childB.yPos but the yPos of the clusters start off null.
Parameters:
node <ClusterNode object>
Returns: boolean
value not used.


The Dendrogrammer © 2011 D.Robb (See Readme for MIT licence). These pages were created with YUIDoc Copyright © 2011 Yahoo! Inc. All rights reserved.