Tree Compression with Top Trees Revisited
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TopDagConstructor< TreeType, DataType > Class Template Reference

Transform a tree into its top tree. More...

#include <TopDagConstructor.h>

Collaboration diagram for TopDagConstructor< TreeType, DataType >:
Collaboration graph
[legend]

Public Member Functions

 TopDagConstructor (TreeType &tree, TopDag< DataType > &topDag, const bool verbose=true, const bool extraVerbose=false)
 
void construct (DebugInfo *debugInfo=NULL)
 

Protected Member Functions

void mergeCallback (const int u, const int v, const int n, const MergeType type)
 
void doMerges (DebugInfo *debugInfo)
 
void horizontalMerges (const int iteration)
 Do one iteration of horizontal merges (step 1) More...
 
void horizontalMergesAllPairs (const int iteration)
 
void verticalMerges (const int iteration)
 Perform an iteration of vertical (chain) merges (step 2) More...
 

Protected Attributes

TreeType & tree
 
TopDag< DataType > & topDag
 
const bool verbose
 
const bool extraVerbose
 
vector< int > nodeIds
 

Detailed Description

template<typename TreeType, typename DataType>
class TopDagConstructor< TreeType, DataType >

Transform a tree into its top tree.

Given a tree (currently, only OrderedTree is supported), construct its top tree iteratively.

The original tree will be modified heavily in the process! When transformation is complete, only one edge will remain and nodes' parent values will be lost as well. In short, this destroys the input tree.

Definition at line 28 of file TopDagConstructor.h.

Constructor & Destructor Documentation

template<typename TreeType, typename DataType>
TopDagConstructor< TreeType, DataType >::TopDagConstructor ( TreeType &  tree,
TopDag< DataType > &  topDag,
const bool  verbose = true,
const bool  extraVerbose = false 
)
inline

Instantiate a top tree constructor

Parameters
treethe tree which shall be transformed. WILL BE MODIFIED
topDagthe output top tree
verbosewhether to print detailed information about the iterations
extraVerbosewhether to print the tree in each iteration

Definition at line 38 of file TopDagConstructor.h.

Member Function Documentation

template<typename TreeType, typename DataType>
void TopDagConstructor< TreeType, DataType >::construct ( DebugInfo debugInfo = NULL)
inline

Perform the top tree construction procedure

Parameters
debugInfopointer to a DebugInfo object, should you wish logging of debug information

Definition at line 43 of file TopDagConstructor.h.

template<typename TreeType, typename DataType>
void TopDagConstructor< TreeType, DataType >::doMerges ( DebugInfo debugInfo)
inlineprotected

do iterated merges to construct a top tree

Parameters
mergeCallbackthe callback that will be called for every pair of merged nodes (clusters). Its arguments are the ids of the two merged nodes and the new id (usually one of the two old ones) as well as the type of the merge
debugInfothe DebugInfo object or NULL
verbosewhether to print detailed information about the iterations
extraVerbosewhether to print the tree in each iteration

Definition at line 63 of file TopDagConstructor.h.

template<typename TreeType, typename DataType>
void TopDagConstructor< TreeType, DataType >::horizontalMerges ( const int  iteration)
inlineprotected

Do one iteration of horizontal merges (step 1)

Definition at line 103 of file TopDagConstructor.h.

template<typename TreeType, typename DataType>
void TopDagConstructor< TreeType, DataType >::horizontalMergesAllPairs ( const int  iteration)
inlineprotected

Do one iteration of horizontal merges (step 1) Modified to look at (1,2), (2,3), (3,4) etc instead of (1,2), (3,4), etc

Definition at line 169 of file TopDagConstructor.h.

template<typename TreeType, typename DataType>
void TopDagConstructor< TreeType, DataType >::mergeCallback ( const int  u,
const int  v,
const int  n,
const MergeType  type 
)
inlineprotected

Definition at line 52 of file TopDagConstructor.h.

template<typename TreeType, typename DataType>
void TopDagConstructor< TreeType, DataType >::verticalMerges ( const int  iteration)
inlineprotected

Perform an iteration of vertical (chain) merges (step 2)

Definition at line 207 of file TopDagConstructor.h.

Member Data Documentation

template<typename TreeType, typename DataType>
const bool TopDagConstructor< TreeType, DataType >::extraVerbose
protected

Definition at line 258 of file TopDagConstructor.h.

template<typename TreeType, typename DataType>
vector<int> TopDagConstructor< TreeType, DataType >::nodeIds
protected

Definition at line 259 of file TopDagConstructor.h.

template<typename TreeType, typename DataType>
TopDag<DataType>& TopDagConstructor< TreeType, DataType >::topDag
protected

Definition at line 257 of file TopDagConstructor.h.

template<typename TreeType, typename DataType>
TreeType& TopDagConstructor< TreeType, DataType >::tree
protected

Definition at line 256 of file TopDagConstructor.h.

template<typename TreeType, typename DataType>
const bool TopDagConstructor< TreeType, DataType >::verbose
protected

Definition at line 258 of file TopDagConstructor.h.


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