#ifndef __FLEXITREE_H #define __FLEXITREE_H #include "../Utils/arrays.h" class FlexiTreeNode; class FlexiTree { private: FlexiTreeNode *children; int root; int id; public: void Write(ostream &s, int &depth); int Read(istream &s, int &depth); int OutputGraph(ostream &s); FlexiTree(); FlexiTree(int d); ~FlexiTree(); void SetRoot(int d) {root = d;} int InsertSeq(const Array &seq, int first, int last); int IsSeqInTree(const Array &seq, int first, int last); int ComputeHDistForTree(Array &seq, int first, int last); friend ostream &operator<<(ostream &s, FlexiTree &tn); friend istream &operator>>(istream &s, FlexiTree &tn); int NumNodes(); // returns the number of nodes in the tree int NumLeaves(); // returns the number of leaves in the tree, i.e num of distinct seqs int NumBranches(); // returns the total # of branches, of all nodes }; //=========================================================================== class SeqForest { public: // this structure is a an array of N tree nodes, i.e. a tree for each value // type Array trees; // this structure is to record what types of values actually occured - // for efficiency, if there were actually fewer value types than // specified in the config Array trees_found; SeqForest(int max_trees) {trees.Allocate(max_trees); trees_found.Allocate(max_trees); trees_found.Set(0);} int IsSeqInForest(const Array &seq, int seq_len) const; }; //=========================================================================== #endif