www.pudn.com > DMFP-Growth.rar > fptree.h
/*----------------------------------------------------------------------
文件 : fptree.h
内容: fptree头文件
作者 : 杨明智,黄昊
----------------------------------------------------------------------*/
#ifndef __FPTREE__
#define __FPTREE__
#include "memsys.h"
#include "tract.h"
/*----------------------------------------------------------------------
预定义
----------------------------------------------------------------------*/
#define FPT_ALTPROJ 0x01
#define FPT_BONSAI 0x02
/*----------------------------------------------------------------------
类型定义
----------------------------------------------------------------------*/
/* FP树结点定义 */
typedef struct _fptnode {
struct _fptnode *succ; /* 指向下一结点的指针 */
struct _fptnode *parent; /* 指向父结点的指针 */
struct _fptnode *copy; /* 辅助复制指针 */
int item; /* 相应的 item */
int cnt; /* transactions 数目 */
} FPTNODE;
typedef struct { /* FP树结点列表*/
int cnt; /* transactions数目 */
FPTNODE *node; /* 指向表中第一个结点的指针 */
} FPTLIST;
typedef struct { /* FP树定义*/
ITEMSET *itemset;
int cnt;
int tra; /* transactions 数目*/
MEMSYS *mem;
FPTLIST lists[1];
} FPTREE;
/*输出函数定义*/
typedef int FPTREPFN (int *ids, int cnt, int supp, void *data);
/*----------------------------------------------------------------------
主函数定义
----------------------------------------------------------------------*/
extern FPTREE* fpt_create (TASET *taset);
extern void fpt_delete (FPTREE *fpt);
extern void fpt_itemset (FPTREE *fpt);
extern int fpt_search (FPTREE *fpt, int supp, int min, int max,
int mode, FPTREPFN report, void *data);
#ifndef NDEBUG
extern void fpt_show (FPTREE *fpt, const char *title);
#endif
#define fpt_itemset(t) ((t)->itemset)
#endif