10 const unsigned RB_NIL = ((unsigned) 0xfff0);
\r
19 m_dLength = (float) dInsane;
\r
23 m_ptrNextCluster = 0;
\r
24 m_ptrPrevCluster = 0;
\r
29 delete[] m_uLeafIndexes;
\r
34 ClustNode *m_ptrLeft;
\r
35 ClustNode *m_ptrRight;
\r
36 ClustNode *m_ptrParent;
\r
37 ClustNode *m_ptrNextCluster;
\r
38 ClustNode *m_ptrPrevCluster;
\r
39 unsigned *m_uLeafIndexes;
\r
48 void Create(ClustSet &Set, CLUSTER Method);
\r
50 unsigned GetLeafCount() const;
\r
52 unsigned GetClusterCount() const;
\r
53 unsigned GetClusterSize(unsigned uNodeIndex) const;
\r
54 unsigned GetLeaf(unsigned uClusterIndex, unsigned uLeafIndex) const;
\r
56 unsigned GetNodeCount() const { return 2*m_uLeafCount - 1; }
\r
57 const ClustNode &GetRoot() const { return m_Nodes[GetRootNodeIndex()]; }
\r
58 unsigned GetRootNodeIndex() const { return m_uNodeCount - 1; }
\r
60 const ClustNode &GetNode(unsigned uNodeIndex) const;
\r
61 bool IsLeaf(unsigned uNodeIndex) const;
\r
62 unsigned GetLeftIndex(unsigned uNodeIndex) const;
\r
63 unsigned GetRightIndex(unsigned uNodeIndex) const;
\r
64 float GetLength(unsigned uNodeIndex) const;
\r
65 float GetHeight(unsigned uNodeIndex) const;
\r
66 const char *GetNodeName(unsigned uNodeIndex) const;
\r
67 unsigned GetNodeId(unsigned uNodeIndex) const;
\r
69 JOIN GetJoinStyle() const { return m_JoinStyle; }
\r
70 LINKAGE GetCentroidStyle() const { return m_CentroidStyle; }
\r
72 void SetDist(unsigned uIndex1, unsigned uIndex2, float dDist);
\r
73 float GetDist(unsigned uIndex1, unsigned uIndex2) const;
\r
75 void ToPhylip(Phylip &tree);
\r
80 void SetLeafCount(unsigned uLeafCount);
\r
82 void CreateCluster();
\r
83 void JoinNodes(unsigned uLeftNodeIndex, unsigned uRightNodeIndex,
\r
84 float dLeftLength, float dRightLength, unsigned uNewNodeIndex);
\r
86 void ChooseJoin(unsigned *ptruLeftIndex, unsigned *ptruRightIndex,
\r
87 float *ptrdLeftLength, float *ptrdRightLength);
\r
88 void ChooseJoinNeighborJoining(unsigned *ptruLeftIndex, unsigned *ptruRightIndex,
\r
89 float *ptrdLeftLength, float *ptrdRightLength);
\r
90 void ChooseJoinNearestNeighbor(unsigned *ptruLeftIndex, unsigned *ptruRightIndex,
\r
91 float *ptrdLeftLength, float *ptrdRightLength);
\r
93 float ComputeDist(unsigned uNewNodeIndex, unsigned uNodeIndex);
\r
94 float ComputeDistAverageLinkage(unsigned uNewNodeIndex, unsigned uNodeIndex);
\r
95 float ComputeDistMinLinkage(unsigned uNewNodeIndex, unsigned uNodeIndex);
\r
96 float ComputeDistMaxLinkage(unsigned uNewNodeIndex, unsigned uNodeIndex);
\r
97 float ComputeDistNeighborJoining(unsigned uNewNewIndex, unsigned uNodeIndex);
\r
98 float ComputeDistMAFFT(unsigned uNewNewIndex, unsigned uNodeIndex);
\r
100 float Calc_r(unsigned uNodeIndex) const;
\r
102 unsigned VectorIndex(unsigned uIndex1, unsigned uIndex2) const;
\r
104 unsigned GetFirstCluster() const;
\r
105 unsigned GetNextCluster(unsigned uNodeIndex) const;
\r
107 float ComputeMetric(unsigned uIndex1, unsigned uIndex2) const;
\r
108 float ComputeMetricNearestNeighbor(unsigned i, unsigned j) const;
\r
109 float ComputeMetricNeighborJoining(unsigned i, unsigned j) const;
\r
111 void InitMetric(unsigned uMaxNodeIndex);
\r
112 void InsertMetric(unsigned uIndex1, unsigned uIndex2, float dMetric);
\r
113 float GetMinMetric(unsigned *ptruIndex1, unsigned *ptruIndex2) const;
\r
114 float GetMinMetricBruteForce(unsigned *ptruIndex1, unsigned *ptruIndex2) const;
\r
115 void DeleteMetric(unsigned uIndex);
\r
116 void DeleteMetric(unsigned uIndex1, unsigned uIndex2);
\r
117 void ListMetric() const;
\r
119 void DeleteFromClusterList(unsigned uNodeIndex);
\r
120 void AddToClusterList(unsigned uNodeIndex);
\r
122 void RBDelete(unsigned RBNode);
\r
123 unsigned RBInsert(unsigned i, unsigned j, float fMetric);
\r
125 unsigned RBNext(unsigned RBNode) const;
\r
126 unsigned RBPrev(unsigned RBNode) const;
\r
127 unsigned RBMin(unsigned RBNode) const;
\r
128 unsigned RBMax(unsigned RBNode) const;
\r
130 void ValidateRB(const char szMsg[] = 0) const;
\r
131 void ValidateRBNode(unsigned Node, const char szMsg[]) const;
\r
135 LINKAGE m_CentroidStyle;
\r
136 ClustNode *m_Nodes;
\r
137 unsigned *m_ClusterIndexToNodeIndex;
\r
138 unsigned *m_NodeIndexToClusterIndex;
\r
139 unsigned m_uLeafCount;
\r
140 unsigned m_uNodeCount;
\r
141 unsigned m_uClusterCount;
\r
142 unsigned m_uTriangularMatrixSize;
\r
144 ClustSet *m_ptrSet;
\r
145 ClustNode *m_ptrClusterList;
\r