00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef Trie_HPP
00010 #define Trie_HPP
00011
00016 typedef unsigned long itemtype;
00017
00018
00019 #include <vector>
00020 #include <set>
00021
00022 using namespace std;
00023
00024 class Apriori_Trie;
00025
00035 class Trie
00036 {
00037 friend class Apriori_Trie;
00038
00039 public:
00040
00041 Trie( Trie* parent, const unsigned long init );
00042
00044 const Trie* is_included( const set<itemtype>& an_itemset, set<itemtype>::const_iterator item_it ) const;
00045
00047 void find_candidate( const vector<itemtype>& basket, const itemtype distance_from_candidate,
00048 vector<itemtype>::const_iterator it_basket, const unsigned long counter_incr=1);
00049
00051 void delete_infrequent( const unsigned long min_occurrence, const itemtype distance_from_candidate );
00052
00053 void show_content_preorder( ) const;
00054 ~Trie();
00055
00056 private:
00058 void max_path_set( );
00059
00061 void add_empty_state( const itemtype item, const unsigned long init_counter=0 );
00062
00063 public:
00064
00065
00066 private:
00073 vector<itemtype> itemvector;
00074
00079 vector<Trie*> statevector;
00080
00082 Trie* parent;
00083
00085 unsigned long counter;
00086
00088 itemtype maxpath;
00089 };
00090
00091
00092 #endif