Top tree data structure.
More...
#include <TopTree.h>
|
| TopTree (const int numLeaves, LabelsT< DataType > &labels) |
|
| TopTree (const int numLeaves) |
|
int | addCluster (const int left, const int right, const MergeType mergeType) |
|
template<typename Callback > |
void | inPostOrder (const Callback &callback) |
|
template<typename Callback > |
void | traverseTreePostOrder (const int clusterId, const Callback &callback) |
| Helper for inPostOrder, you shouldn't need to use this. More...
|
|
template<typename T , typename Callback > |
T | foldPostOrder (const Callback &callback, const T initial) const |
|
template<typename T , typename Callback > |
T | traverseFoldPostOrder (const int clusterId, const Callback &callback, const T initial) const |
| Helper function for foldPostOrder(). You should not need to use this directly. More...
|
|
int | height () const |
| Get the height of the top tree. More...
|
|
int | minDepth () const |
| Get the depth of the highest leaf. More...
|
|
double | avgDepth () const |
| Get the average depth of all nodes. More...
|
|
bool | isEqual (const TopTree< DataType > &other) const |
| Check equality with another subtree. More...
|
|
bool | nodesEqual (const TopTree< DataType > &other, const int clusterId, const int otherClusterId) const |
| Helper for isEqual, you shouldn't need to use this directly. More...
|
|
template<typename DataType>
struct TopTree< DataType >
Top tree data structure.
Definition at line 15 of file TopTree.h.
template<typename DataType>
Create a top tree with labelled leaves
- Parameters
-
numLeaves | number of leaves in the top tree |
labels | the labels to assign to the leaves |
Definition at line 19 of file TopTree.h.
template<typename DataType>
Create a top tree with a fixed number of leaves
- Parameters
-
numLeaves | the number of leaves. Not terribly relevant, but other parts use this to do stuff [TM] |
Definition at line 28 of file TopTree.h.
template<typename DataType>
int TopTree< DataType >::addCluster |
( |
const int |
left, |
|
|
const int |
right, |
|
|
const MergeType |
mergeType |
|
) |
| |
|
inline |
Add a cluster to the top tree
- Parameters
-
left | left child |
right | right child |
mergeType | the type of merge that formed this cluster |
- Returns
- the new cluster's ID
Definition at line 35 of file TopTree.h.
template<typename DataType>
double TopTree< DataType >::avgDepth |
( |
| ) |
const |
|
inline |
Get the average depth of all nodes.
Definition at line 97 of file TopTree.h.
template<typename DataType>
template<typename T , typename Callback >
T TopTree< DataType >::foldPostOrder |
( |
const Callback & |
callback, |
|
|
const T |
initial |
|
) |
| const |
|
inline |
Traverse the top tree in post order, applying a callback to the callback results of its children
- Parameters
-
callback | function to be called on its results of the left and right child |
initial | value to use as "callback result" for leaves |
Definition at line 64 of file TopTree.h.
template<typename DataType>
int TopTree< DataType >::height |
( |
| ) |
const |
|
inline |
Get the height of the top tree.
Definition at line 83 of file TopTree.h.
template<typename DataType>
template<typename Callback >
void TopTree< DataType >::inPostOrder |
( |
const Callback & |
callback | ) |
|
|
inline |
Traverse the tree in post order
- Parameters
-
callback | callback to call with the cluster ID as parameter |
Definition at line 43 of file TopTree.h.
template<typename DataType>
bool TopTree< DataType >::isEqual |
( |
const TopTree< DataType > & |
other | ) |
const |
|
inline |
Check equality with another subtree.
Definition at line 110 of file TopTree.h.
template<typename DataType>
int TopTree< DataType >::minDepth |
( |
| ) |
const |
|
inline |
Get the depth of the highest leaf.
Definition at line 90 of file TopTree.h.
template<typename DataType>
bool TopTree< DataType >::nodesEqual |
( |
const TopTree< DataType > & |
other, |
|
|
const int |
clusterId, |
|
|
const int |
otherClusterId |
|
) |
| const |
|
inline |
Helper for isEqual, you shouldn't need to use this directly.
Definition at line 119 of file TopTree.h.
template<typename DataType>
template<typename T , typename Callback >
T TopTree< DataType >::traverseFoldPostOrder |
( |
const int |
clusterId, |
|
|
const Callback & |
callback, |
|
|
const T |
initial |
|
) |
| const |
|
inline |
template<typename DataType>
template<typename Callback >
void TopTree< DataType >::traverseTreePostOrder |
( |
const int |
clusterId, |
|
|
const Callback & |
callback |
|
) |
| |
|
inline |
Helper for inPostOrder, you shouldn't need to use this.
Definition at line 49 of file TopTree.h.
template<typename DataType>
std::ostream& operator<< |
( |
std::ostream & |
os, |
|
|
const TopTree< DataType > & |
toptree |
|
) |
| |
|
friend |
template<typename DataType>
template<typename DataType>
The documentation for this struct was generated from the following file: