Vespucci  1.0.0
ahcanode.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright (C) 2014-2016 Wright State University - All Rights Reserved
3  Daniel P. Foose - Maintainer/Lead Developer
4 
5  This file is part of Vespucci.
6 
7  Vespucci is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  Vespucci is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with Vespucci. If not, see <http://www.gnu.org/licenses/>.
19 *******************************************************************************/
22 {
23  parent_ = NULL;
24  child1_ = child1;
25  child2_ = child2;
26  distance_ = distance;
27  if (child1_) child1_->SetParent(this);
28  if (child2_) child2_->SetParent(this);
29 }
30 
32 {
33  delete child1_;
34  delete child2_;
35 }
36 
38 {
39  return distance_;
40 }
41 
43 {
44  return child1_;
45 }
46 
48 {
49  return child2_;
50 }
51 
53 {
54  return arma::join_vert(child1_->GetChildIndices(), child2_->GetChildIndices());
55 }
56 
58 {
59  parent_ = parent;
60 }
61 
63 {
64  return parent_;
65 }
66 
73 {
74  return (child1_ != NULL) && (child2_ != NULL);
75 }
76 
78  :Vespucci::Math::Clustering::AHCANode(NULL, NULL, 0)
79 {
80  index_ = index;
81 }
82 
84 {
85  return index_;
86 }
87 
89 {
90  return arma::uvec({index_});
91 }
The AHCANode class This class stores a node in the data structure representing the AHCA dendrogram Th...
Definition: ahcanode.h:34
Vespucci::Math::Clustering::AHCANode * parent()
Definition: ahcanode.cpp:62
Vespucci::Math::Clustering::AHCANode * child2()
Definition: ahcanode.cpp:47
void SetParent(Vespucci::Math::Clustering::AHCANode *parent)
Definition: ahcanode.cpp:57
virtual arma::uvec GetChildIndices()
Definition: ahcanode.cpp:52
AHCANode(Vespucci::Math::Clustering::AHCANode *child1, Vespucci::Math::Clustering::AHCANode *child2, double distance)
Definition: ahcanode.cpp:21
Vespucci::Math::Clustering::AHCANode * child1()
Definition: ahcanode.cpp:42
bool HasChildren()
Vespucci::Math::Clustering::AHCANode::HasChildren.
Definition: ahcanode.cpp:72
A namespace for "global" functions, including math functions.