Class to encapsulate cluster information and aid in building clusters using Minimum Spanning Tree (MST) data. More...
#include <MSTCluster.h>
Public Member Functions | |
MSTCluster (MSTCluster *owner=NULL, const std::string &name="") | |
~MSTCluster () | |
void | makeClusters (NodeList &nodeList, const ESTAnalyzer *analyzer, const float threshold) |
Method to make clusters. | |
float | calculateThreshold (NodeList &nodeList) |
Method to automatically calculate a threshold. | |
void | add (const MSTNode &node) |
Add a MST Node to this cluster. | |
void | add (MSTCluster *child) |
Add a child cluster to this cluster. | |
void | add (const int clusterID, const MSTNode &node) |
Method to directly add a given EST to a dummy clusterID. | |
void | printClusterTree (std::ostream &os=std::cout, const std::string &prefix="") const |
Print the cluster tree. | |
void | guiPrintClusterTree (std::ostream &os=std::cout, const char *srcFile=NULL) const |
Print the cluster tree in a different format. | |
void | makeMergedClusters (const int size, int *parent, bool *root) |
makeMergedClusters | |
int | getClusterID () const |
Gets the ID of this cluster. | |
Protected Member Functions | |
void | guiPrintTree (std::ostream &os) const |
A helper method for the guiPrintClusterTree method. | |
Private Attributes | |
ClusterList | clusterList |
List of sub-clusters for this cluster. | |
const MSTCluster * | parent |
NodeList | members |
const int | clusterID |
const std::string | name |
A name set to identify filtered clusters. | |
Static Private Attributes | |
static int | clusterIDSequence = 0 |
Instance variable to track the next available cluster ID. | |
static ClusterList | globalClusterList |
Global list to maintain reference to all the MSTClusters created. | |
Friends | |
std::ostream & | operator<< (std::ostream &, const MSTCluster &) |
Class to encapsulate cluster information and aid in building clusters using Minimum Spanning Tree (MST) data.
This class was introduced to encapsulate and manage the data associated with various clusters built using MST information.
Definition at line 57 of file MSTCluster.h.
MSTCluster::MSTCluster | ( | MSTCluster * | owner = NULL , |
|
const std::string & | name = "" | |||
) |
Definition at line 52 of file MSTCluster.cpp.
References ASSERT, clusterID, and globalClusterList.
Referenced by makeClusters(), and makeMergedClusters().
MSTCluster::~MSTCluster | ( | ) |
Definition at line 59 of file MSTCluster.cpp.
References clusterID, clusterList, globalClusterList, and members.
void MSTCluster::add | ( | const int | clusterID, | |
const MSTNode & | node | |||
) |
Method to directly add a given EST to a dummy clusterID.
This method is typically used to add a EST that has been filtered out by a filter to a specific cluster. The cluster maker typically creates a dummy MSTNode with the necessary information to be added.
clusterID | The ID/index of the cluster to which the MST node is to be added. | |
[in] | node | The MSTNode entry to be added to this cluster. |
Definition at line 78 of file MSTCluster.cpp.
References ASSERT, and globalClusterList.
void MSTCluster::add | ( | MSTCluster * | child | ) |
Add a child cluster to this cluster.
This method must be used to add a child cluster this cluster. Note that the parent cluster must be appropriately set in the child to refer to this MSTCluster.
[in] | child | The child node to be added to the this cluster. |
Definition at line 88 of file MSTCluster.cpp.
References ASSERT, clusterList, and parent.
void MSTCluster::add | ( | const MSTNode & | node | ) |
Add a MST Node to this cluster.
[in] | node | The node ot be added to the cluster. |
Definition at line 73 of file MSTCluster.cpp.
References members.
Referenced by MSTClusterMaker::addDummyCluster(), MSTClusterMaker::addEST(), makeClusters(), and makeMergedClusters().
float MSTCluster::calculateThreshold | ( | NodeList & | nodeList | ) |
Method to automatically calculate a threshold.
Currently this method is called only when the threshold supplied to MSTCluster::makeClusters() is equal to -1. This threshold corresponds to the CLU analyzer and tells the calculateThreshold method to calculate the threshold based on the mean and variance of scoring metrics among the list of MST nodes.
nodeList | The list of nodes in the MST |
Definition at line 168 of file MSTCluster.cpp.
Referenced by PMSTClusterMaker::makeClusters(), and makeClusters().
int MSTCluster::getClusterID | ( | ) | const [inline] |
Gets the ID of this cluster.
Definition at line 149 of file MSTCluster.h.
Referenced by MSTClusterMaker::addDummyCluster().
void MSTCluster::guiPrintClusterTree | ( | std::ostream & | os = std::cout , |
|
const char * | srcFile = NULL | |||
) | const |
Print the cluster tree in a different format.
As above, but prints the cluster tree in a format recognizable by the PEACE GUI and suitable for GUI processing.
Definition at line 248 of file MSTCluster.cpp.
References ASSERT, arg_parser::get_global_args(), getTime(), getTimeStamp(), guiPrintTree(), and parent.
Referenced by MSTClusterMaker::buildAndShowClusters().
void MSTCluster::guiPrintTree | ( | std::ostream & | os | ) | const [protected] |
A helper method for the guiPrintClusterTree method.
Works by printing the data for the current cluster and then calling guiPrintTree on the sub-clusters (if any).
Definition at line 270 of file MSTCluster.cpp.
References clusterID, clusterList, members, name, and parent.
Referenced by guiPrintClusterTree().
void MSTCluster::makeClusters | ( | NodeList & | nodeList, | |
const ESTAnalyzer * | analyzer, | |||
const float | threshold | |||
) |
Method to make clusters.
This method takes a supplied list of nodes from an MST, an EST analyzer, and a threshold score, and uses them to break the MST into clusters based on the threshold.
nodeList | The list of nodes in the MST | |
analyzer | The ESTAnalyzer used for score computation | |
threshold | The threshold value for separating clusters |
Definition at line 95 of file MSTCluster.cpp.
References add(), ASSERT, calculateThreshold(), clusterList, ESTAnalyzer::compareMetrics(), MSTCluster(), and parent.
Referenced by MSTClusterMaker::buildAndShowClusters().
void MSTCluster::makeMergedClusters | ( | const int | size, | |
int * | parent, | |||
bool * | root | |||
) |
makeMergedClusters
Currently not used in the code.
Definition at line 187 of file MSTCluster.cpp.
References add(), ASSERT, clusterList, and MSTCluster().
Referenced by PMSTClusterMaker::mergeManager().
void MSTCluster::printClusterTree | ( | std::ostream & | os = std::cout , |
|
const std::string & | prefix = "" | |||
) | const |
Print the cluster tree.
This method prints a tree display of the clusters.
Definition at line 216 of file MSTCluster.cpp.
References clusterID, clusterList, members, and name.
Referenced by MSTClusterMaker::buildAndShowClusters(), and PMSTClusterMaker::makeClusters().
std::ostream& operator<< | ( | std::ostream & | , | |
const MSTCluster & | ||||
) | [friend] |
const int MSTCluster::clusterID [private] |
Definition at line 172 of file MSTCluster.h.
Referenced by guiPrintTree(), MSTCluster(), operator<<(), printClusterTree(), and ~MSTCluster().
int MSTCluster::clusterIDSequence = 0 [static, private] |
Instance variable to track the next available cluster ID.
This instance variable is used to generate unique cluster ID values for each newly created cluster. It is intialized to zero. Each time a cluster is instantiated, the constructor uses this value to set the clusterID and then increments this value.
Definition at line 193 of file MSTCluster.h.
ClusterList MSTCluster::clusterList [private] |
List of sub-clusters for this cluster.
This instance variable is used to maintain the list of sub-clusters for this cluster. Entries are added to this list whenever sub-clusters are created in the MSTCluster::makeClusters() method.
Definition at line 168 of file MSTCluster.h.
Referenced by add(), guiPrintTree(), makeClusters(), makeMergedClusters(), operator<<(), printClusterTree(), and ~MSTCluster().
ClusterList MSTCluster::globalClusterList [static, private] |
Global list to maintain reference to all the MSTClusters created.
This list is used to maintain a pointer to all the MST clusters ever created. This list is used to look up clusters given the index of the cluster.
Definition at line 203 of file MSTCluster.h.
Referenced by add(), MSTCluster(), and ~MSTCluster().
NodeList MSTCluster::members [private] |
Definition at line 171 of file MSTCluster.h.
Referenced by add(), guiPrintTree(), operator<<(), printClusterTree(), and ~MSTCluster().
const std::string MSTCluster::name [private] |
A name set to identify filtered clusters.
The name is set when dummy clusters are created to add ESTs that were filtered out based on a specific condition. The named clusters are typically created by filters. By default clusters don't have a name. These indicate regular clusters.
Definition at line 183 of file MSTCluster.h.
Referenced by guiPrintTree(), operator<<(), and printClusterTree().
const MSTCluster* MSTCluster::parent [private] |
Definition at line 170 of file MSTCluster.h.
Referenced by add(), guiPrintClusterTree(), guiPrintTree(), and makeClusters().