MST Class Reference

Class to represent a Minimum Spanning Tree (MST). More...

#include <MST.h>

List of all members.

Public Member Functions

 MST (const int maxNodes, const bool haveAlignmentMetric)
 The constructor.
 ~MST ()
 The destructor.
bool hasAlignmentMetric () const
 Determine if nodes in this MST have alignment metric values.
void addNode (const int parentIdx, const int estIdx, const float similarity, const int alignmentInfo, const int directionInfo)
 Convenience method to add a MSTNode to the EST.
NodeListgetNodes ()
 Obtain a mutable list of nodes in this MST.
void serialize (const char *fileName, const char *srcFile, const float threshold) const
 Helper method to write MST data to a given file.
float getMSTDistance () const
 Obtain the total distance of this MST.

Static Public Member Functions

static MSTdeSerialize (const char *fileName)
 Method to create and load data for MST from a text file.

Private Attributes

NodeList nodeList
 The list of nodes in this MST.
bool haveAlignmentMetric
 Instance variable to indicate if alignment metric in nodes is valid.

Friends

std::ostream & operator<< (std::ostream &, const MST &)

Detailed Description

Class to represent a Minimum Spanning Tree (MST).

This class is used to represent a MST that is built by the MSTClusterMaker. It essentially maintains a vector of MSTNode objects. The order of nodes in the MST reflects the order in which nodes were added to create the tree. Refer to the documentation on the MSTNode class for details on the data encapsulated by it.

Definition at line 58 of file MST.h.


Constructor & Destructor Documentation

MST::MST ( const int  maxNodes,
const bool  haveAlignmentMetric 
)

The constructor.

The default constructor for the MST. The constructor performs no special operations and is present merely to adhere to coding conventions.

Parameters:
[in] maxNodes The number of nodes for which space must be initially reserved. Reserving space reduces the number of times the MST has to reallocate memory as nodes are added to it.
[in] haveAlignmentMetric If this value is true, then that indicates that this MST also includes additional alignment information with each node in the MST.

Definition at line 43 of file MST.cpp.

References nodeList.

Referenced by deSerialize().

MST::~MST (  )  [inline]

The destructor.

The destructor performs no special tasks as the base class (std::vector) performs all the necessary cleanups.

Definition at line 84 of file MST.h.


Member Function Documentation

void MST::addNode ( const int  parentIdx,
const int  estIdx,
const float  similarity,
const int  alignmentInfo,
const int  directionInfo 
)

Convenience method to add a MSTNode to the EST.

This method may be used to append a node to the EST. The first node to be added must be root node (with parentIndex set to -1). This method performs no special checks to verify the integrity of the data.

Parameters:
[in] parentIdx The index of the parent EST for this Node. If a parent does not exist, then this value should be -1.
[in] estIdx The index of the EST. This value must be the index of the corresponding EST in the list of ESTs returned by EST::getESTList() method.
[in] similarity The similarity metric between this EST and its parent EST.
[in] alignmentInfo Additional alignment information between the parentIdx and the estIdx to be stored in this node.
[in] directionInfo Additional direction information between the parentIdx and the estIdx to be stored in this node.

Definition at line 51 of file MST.cpp.

References nodeList.

Referenced by PMSTClusterMaker::addMoreChildESTs(), MSTClusterMaker::addMoreChildESTs(), PMSTClusterMaker::manager(), MSTClusterMaker::manager(), and PMSTClusterMaker::mergeManager().

MST * MST::deSerialize ( const char *  fileName  )  [static]

Method to create and load data for MST from a text file.

This method creates an MST and populates it with node data from a given text file. The text file must have been created through an earlier call to the serialize() method. If the MST was successfully populated then this method returns a pointer to the newly created MST. On errors this method returns NULL.

Parameters:
[in] fileName The text file from which the data for the MST must be read.
Returns:
On success this method returns a valid pointer to the newly created (and populated) MST. On errors it returns NULL.

Definition at line 91 of file MST.cpp.

References MSTNode::deSerialize(), haveAlignmentMetric, MST(), and nodeList.

Referenced by PMSTClusterMaker::makeClusters(), and MSTClusterMaker::populateMST().

float MST::getMSTDistance (  )  const

Obtain the total distance of this MST.

This method can be used to determine the total distance of the MST. This method iterates over all the nodes present in the MST and adds the distance/similarity metric together. It then returns the total.

Returns:
The total MST distance for this MST. If the MST has one (or zero) nodes then this method returns 0 (zero).

Definition at line 125 of file MST.cpp.

References nodeList.

Referenced by serialize().

NodeList& MST::getNodes (  )  [inline]

Obtain a mutable list of nodes in this MST.

This method can be used to obtain a mutable list of nodes in contained by this MST.

Returns:
A reference to the list of nodes encapsulated by this class.

Definition at line 134 of file MST.h.

References nodeList.

Referenced by MSTClusterMaker::buildAndShowClusters(), PMSTClusterMaker::mergeManager(), and PMSTClusterMaker::mergeWorker().

bool MST::hasAlignmentMetric (  )  const [inline]

Determine if nodes in this MST have alignment metric values.

This method can be used to determine if the nodes in this MST have alignment information saved for each node.

Returns:
This method returns true if the nodes in this MST have alignment metric.

Definition at line 94 of file MST.h.

void MST::serialize ( const char *  fileName,
const char *  srcFile,
const float  threshold 
) const

Helper method to write MST data to a given file.

This method is a helper method that is used to write MST data to a given output file. This method is typically called from the makeClusters() method after MST construction has been completed.

Parameters:
[in] fileName The file to which the MST data is to be written.
[in] srcFile The source file from where the ESTs were read. This file name is simply used for cross reference in the data generated for this MST.
[in] threshold The threshold value to be used in clustering of the MST data. Important for downstream analysis such as that done by assembly tools.

Definition at line 59 of file MST.cpp.

References arg_parser::get_global_args(), getMSTDistance(), getTime(), getTimeStamp(), haveAlignmentMetric, and nodeList.

Referenced by PMSTClusterMaker::makeClusters(), and MSTClusterMaker::makeClusters().


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
const MST  
) [friend]

Member Data Documentation

bool MST::haveAlignmentMetric [private]

Instance variable to indicate if alignment metric in nodes is valid.

This instance variable is initialized when this MST is created. If this instance variable is true then each Node in this MST has a valid alignment information.

Definition at line 202 of file MST.h.

Referenced by deSerialize(), and serialize().

The list of nodes in this MST.

This vector is used to track the set of nodes added to this minimum spanning tree. The maximum nodes in the tree is typically set in the constructor. Nodes are added via the addNode() method in this class.

Definition at line 193 of file MST.h.

Referenced by addNode(), deSerialize(), getMSTDistance(), getNodes(), MST(), operator<<(), and serialize().


The documentation for this class was generated from the following files:

Generated on 19 Mar 2010 for PEACE by  doxygen 1.6.1