?? myapriori.h
字號:
//***********************************************//
// 程序編寫者:wentrue
// 編譯環境:VC7.0,控制臺程序
// 關于本程序的任何問題或意見,可聯系本人:wentrue@mail.ustc.edu.cn
//***********************************************//
#pragma once
#include "resource.h"
typedef struct tagKeyTree{ //數據庫關鍵字樹
CString Key; //關鍵字
CString IndexSet; //關鍵字出現的記錄號的集,以分號分隔
WORD count; //關鍵字在數據庫中出現的次數
struct tagKeyTree *left; //指向左兒子的指針
struct tagKeyTree *right; //指向右兒子的指針
}KeyTree;
typedef struct tagItemSet{ //K-項集鏈表
CString datastr;
WORD count;
struct tagItemSet *next;
}ItemSet,ItemSetLink;
KeyTree* ReadDataFromText(CString filename,int *RC); //從TXT文件中讀入數據
CString GetLine(CFile* const f); //從文件中讀出一行字符
KeyTree* UpdateKeyTree(KeyTree* KT,CString sw,int count); //根據讀入的每一組關鍵字,更新關鍵字樹
ItemSet* find_frequent_1_itemset(KeyTree* KT,int min_count); //發現1-項集
KeyTree* FindMin(KeyTree* KT); //在KT中搜索最小的元素
KeyTree* DeleteNode(KeyTree* ST,CString str); //在KT中搜索關鍵字為str的節點并刪除
KeyTree* SearchAndDelInTree(KeyTree* KT,int min_count); //在給定的搜索二叉樹中剔除掉出現次數低于min_count的結點
ItemSetLink* GetDataLink(KeyTree* KT); //把二叉搜索樹中的結點按升序讀取出來組成鏈表
void PrintResult(ItemSet* IS,int k,CString exstr1); //輸出頻繁集結果
ItemSetLink* apriori_gen(ItemSet* IS,int k); //根據頻繁k-1項集IS產生候選k-項集
ItemSet* find_frequent_k_itemset(KeyTree* KT,ItemSetLink* preIS,int k,int min_count); //掃描關鍵字樹發現k-項集
BOOL has_infrequent_subset(CString str,ItemSet* IS); //搜索候選k-項集中k-1項集不頻繁的元素
ItemSetLink* CreatePreItemSet(ItemSetLink* preIS,CString str,int k); //構建候選頻繁k項集鏈表
CString FindInKeyTree(KeyTree* KT,CString str); //在關鍵字樹中搜索str,并返回相應的IndexSet字段
int CountForKey(CStringArray* SA,int k); //根據存儲在SA中的幾個IndexSet字符串,計算其公共子串的數目
int MinnIndex(int* nIndexArray,int k); //返回數組中最大值的下標
BOOL SomeIsEnd(int* nStart,int k); //檢測某些字符串是否已經檢索結束
void GetRecordNum(CStringArray* SA,int* nValue,int* nStart,int* nEnd,int k); //從SL中獲得下一組記錄號
ItemSet* Del_k_ItemSet(ItemSet* IS,int min_count); //在已計數好的ItemSet中刪除非頻繁節點
ItemSetLink* DeleteLink(ItemSetLink* IS); //釋放鏈表IS的內存空間
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -