00001 /*************************************************************************** 00002 Trie.hpp - description 00003 ------------------- 00004 begin : cs dec 26 2002 00005 copyright : (C) 2002 by Ferenc Bodon 00006 email : bodon@mit.bme.hu 00007 ***************************************************************************/ 00008 00009 #ifndef Trie_HPP 00010 #define Trie_HPP 00011 00016 #include "common.hpp" 00017 #include <vector> 00018 #include <set> 00019 00020 using namespace std; 00021 00022 class MSApriori_Trie; 00023 class Trie; 00024 00029 struct Edge 00030 { 00031 itemtype label; 00032 Trie* subtrie; 00033 }; 00034 bool Edge_point_less(const Edge edge, const itemtype label); 00044 class Trie 00045 { 00046 friend class MSApriori_Trie; 00047 00048 public: 00049 00050 Trie( Trie* parent_trie, const unsigned long init_counter ); 00051 00053 const Trie* is_included( const set<itemtype>& an_itemset, set<itemtype>::const_iterator item_it ) const; 00054 00056 void find_candidate( const vector<itemtype>& basket, const itemtype distance_from_candidate, 00057 vector<itemtype>::const_iterator it_basket, const unsigned long counter_incr=1); 00058 00060 void delete_infrequent( const double min_occurrence, const itemtype distance_from_candidate ); 00061 00063 void show_content_preorder( ) const; 00064 ~Trie(); 00065 00066 private: 00068 void max_path_set( ); 00069 00071 void add_empty_state( const itemtype item, const unsigned long init_counter=0 ); 00072 00073 public: 00074 // No public members 00075 00076 private: 00077 00079 Trie* parent; 00080 00082 unsigned long counter; 00083 00088 vector<Edge> edgevector; 00089 00091 itemtype maxpath; 00092 }; 00093 00094 00095 #endif