亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? fim_all.cpp

?? 頻繁模式挖掘算法
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/*
 
   Copyright (C) 2003 Mohammad El-Hajj and Osmar R. Zaiane 
                      (University of Alberta, Canada)
                         ALL RIGHTS RESERVED.


  The enclosed software and documentation includes copyrighted works.
  It is submitted exclusively for the Workshop of Frequent Itemset Mining 
  Implementations (FIMI'03) to be held in Melbourne, FL, USA in 
  conjunction with ICDM 2003 on November 19, 2003.

  This code is not to be distributed until further explicit notice by the 
  authors. 

  This code shall not be modified or distributed and the copyright notices 
  should not be deleted from the code or documentation.

  COFI Algorithm Implementation

  Date 26-09-2003  
*/


#include <stdio.h>
#include <fstream.h> 
#include <iostream>
#include <time.h>
#include <malloc.h>
#include <vector>

long Maxtransactionsize;
long DimentionSize;
long ProblemSize;
long support;
long GeneralCounter;
int printingflag;
long mxtransaction;


FILE *fp;
FILE *fpout;

// data structr for a node of the FP-tree
 struct FPTTree
{
  long  Element;
  long   counter;
  FPTTree* child;  
  FPTTree* brother;
  FPTTree* father;
  FPTTree* next;
};

struct COFITree
{
  long  Element;
  long  counter;
  long  participation;
  COFITree* child;
  COFITree* brother;
  COFITree* father;
  COFITree* next;
};

struct FrequentTree
{
  long  Element;
  long  counter;
  char  text[100];
  int depth;
  FrequentTree* child;
  FrequentTree* brother;
  FrequentTree* father;
  FrequentTree* next;
};

FrequentTree* RootOrignal;
struct FrequentStruc
{
  long  Item;
  long   Frequency;  
  long   COFIFrequency;  
  long   COFIFrequency1; 
  FPTTree* first;
  COFITree* firstCOFI;
 };
 


class Transaction
{ 
public : 
       long ID; 
	   long* Items; 	   
}; 
 


struct TransactionRecord
{
  long  Element;
  long  Index;
};

struct ItemsStructure
{
	long Item;
	long Frequency;

};

struct CandidateStructures
{
	ItemsStructure *ArrayOfCandidates;
};


 long* COFIPattern;
 long* FrequentPattern;
 long DepthArray[500];

 CandidateStructures *Candidate_Items;
 FrequentStruc *F1_Items; 
 long No_Of_Frequent1_Items,F1_Size; 
 TransactionRecord *TransactionArray; 
 long* FindInHashTable;
 int Transaction_Frequent_size;
 fstream outfile;
 Transaction Trans;
 int Index_FrequentStruc,New_Index_FrequentStruc;
 FPTTree* First;
 long tran;
 FrequentTree* CurrentF ;
 FrequentTree* FatherF;
 FrequentTree* RootF;
 FrequentTree* NewCurrentF;
 FrequentTree* LastBrotherF;
 


 
//clock_t start1, finish1,start2, finish2,start3, finish3,start4, finish4,start5, finish5,startf, finishf;
//double  duration1,duration2,duration3,duration4,duration5,duration6,duration7,durationp,durationpt;
long LineRead;

//void InitializeItems(long offset, long candidateindex)
void InitializeItems()
{
int i,k;	

	for (i=0;i<=500;++i)
	{
	Candidate_Items[i].ArrayOfCandidates  = (ItemsStructure *)malloc((1000+1)*sizeof(ItemsStructure));
		for (k=0;k<1000;++k)
	{
		
		Candidate_Items[i].ArrayOfCandidates[k].Item =k+(i*1000);
		Candidate_Items[i].ArrayOfCandidates[k].Frequency = 0;
		
				
	}
	}

} // end Initialise Items


long ElementLocation(long element)
{
	long location;
	location = FindInHashTable[element];
	return location;
}

void traverseCOFI(COFITree* Root,int i)

{

	// Recursive deletion of COFI tree
if (Root != NULL)
{
printf ("Item = %ld, depth = %d, counter = %ld ",Root->Element,i,Root->counter);
if (Root->child != NULL)
{
	printf ("Child Item = %ld\n",Root->child->Element);
}
else
{
	printf ("\n");
}
if (Root->brother  != NULL)
{
	printf ("Brother Item = %ld\n",Root->brother->Element);
}
else
{
	printf ("\n");
}
}
if (Root->child != NULL)
		traverseCOFI(Root->child ,i+1);
	
if (Root->brother != NULL)
		traverseCOFI(Root->brother,i);


}


void traverseFrequent(FrequentTree* Root,int i)

{

	// Recursive deletion of COFI tree
if (Root != NULL)
{
printf ("Item = %ld, depth = %d, items = %s, counter = %ld ",Root->Element,i,Root->text ,Root->counter);
if (Root->child != NULL)
{
	printf ("Child Item = %ld\n",Root->child->Element);
}
else {printf ("No child\n");}
}
if (Root->child != NULL)
		traverseFrequent(Root->child ,i+1);
	
if (Root->brother != NULL)
		traverseFrequent(Root->brother,i);


}


long SizeOf1Frequent ()
{
	
	long i,j,k;
	j=0;
	for (i=0;i<=500;++i)
	{
		for (k=0;k<=1000;++k)
			{
				if (Candidate_Items[i].ArrayOfCandidates[k].Frequency >= support)
				{
				++j;					
				}				
			}
	}
	return j;
	
}


void sortfrequent( long lo, long up )
     {
	 int i, j;
     FrequentStruc  tempr;
     while ( up>lo ) {
          i = lo;
          j = up;
          tempr = F1_Items[lo];
          /*** Split file in two ***/
          while ( i<j ) {
               for ( ; F1_Items[j].Frequency > tempr.Frequency; j-- );
               for ( F1_Items[i]=F1_Items[j]; i<j && F1_Items[i].Frequency<=tempr.Frequency; i++ );
               F1_Items[j] = F1_Items[i];
               }
          F1_Items[i] = tempr;
          /*** Sort recursively, the smallest first ***/
          if ( i-lo < up-i ) { sortfrequent(lo,i-1);  lo = i+1; }
               else    { sortfrequent(i+1,up);  up = i-1; }
          }
     }


void Sort_Transaction( long lo, long up )
     {
	 int i, j;
     TransactionRecord  tempr;
     while ( up>lo ) {
          i = lo;
          j = up;
          tempr = TransactionArray[lo];
          /*** Split file in two ***/
          while ( i<j ) 
				{
               for ( ; TransactionArray[j].Index > tempr.Index; j-- );
               for ( TransactionArray[i]=TransactionArray[j]; i<j && TransactionArray[i].Index<=tempr.Index; i++ );
               TransactionArray[j] = TransactionArray[i];
				}
          TransactionArray[i] = tempr;
          /*** Sort recursively, the smallest first ***/
          if ( i-lo < up-i ) { Sort_Transaction(lo,i-1);  lo = i+1; }
               else    { Sort_Transaction(i+1,up);  up = i-1; }
          }
     }


void SortFrequent()
{
		long  i , j,k,d;

	
		j = 0;
		i=0;
		k=0;
		for (d=0;d<=DimentionSize;d++)
		{
		
				if (Candidate_Items[i].ArrayOfCandidates [k].Frequency >= support)
				{
					F1_Items[j].Item = Candidate_Items[i].ArrayOfCandidates[k].Item ;
					F1_Items[j].Frequency  = Candidate_Items[i].ArrayOfCandidates[k].Frequency ;
					F1_Items[j].first = NULL;
					F1_Items[j].firstCOFI = NULL;
					F1_Items[j].COFIFrequency = 0;
					F1_Items[j].COFIFrequency1 = 0;
					++j		;							
				}
				++k;
				if (k%1000 == 0)
				{
					++i;
					k=0;
				}
		}
		sortfrequent(0,j-1);
}

void BuildHashTable()
{
long i;
for (i=0; i<=F1_Size; ++i)
{
	// search for the location of that item	 
	FindInHashTable[F1_Items[i].Item] = i;
} // end for

}


void ReadingFromText()
{
	
char c;
int i;
i=0;

 do {
    int item=0, pos=0;
    c = getc(fp);
    while((c >= '0') && (c <= '9')) {
      item *=10;
      item += int(c)-int('0');
      c = getc(fp);
      pos++;
    }
    if(pos) {
		Trans.Items[i] = item;
		++i;
		}
  }while(c != '\n' && !feof(fp));
 tran = i;
 if (tran > mxtransaction)
	 mxtransaction = tran;

}



bool SearchFrequentBrother(long Item,FrequentTree*& NewCurrent,FrequentTree*& LastBrother)
{

bool found,over;
found = false;
over = false;
LastBrother = NULL;

	while ((NewCurrent != NULL) && (!found) && (!over))
	{
		if (NewCurrent->Element == Item)
		found = true;
		else if (F1_Items[FindInHashTable[Item]].COFIFrequency > F1_Items[FindInHashTable[NewCurrent->Element]].COFIFrequency)
		over = true;
		else 
		{
			LastBrother = NewCurrent;
			NewCurrent  = NewCurrent->brother;
		}
	} // End while ((Current != NULL) && (!found))
return found;

} // End bool SearchFTPBrother(NewTransactionArray[i],Current,NewCurrent)



bool SearchCOFIBrother(long Item,COFITree*& NewCurrent,COFITree*& LastBrother)
{
bool found,over;
found = false;
over = false;
LastBrother = NULL;

	while ((NewCurrent != NULL) && (!found) && (!over))
	{
		if (NewCurrent->Element == Item)
		found = true;
		else if (F1_Items[FindInHashTable[Item]].COFIFrequency > F1_Items[FindInHashTable[NewCurrent->Element]].COFIFrequency)
		over = true;
		else 
		{
			LastBrother = NewCurrent;
			NewCurrent  = NewCurrent->brother;
		}
	} // End while ((Current != NULL) && (!found))
return found;
} // End bool SearchFTPBrother(NewTransactionArray[i],Current,NewCurrent)


bool SearchFTPBrother(struct TransactionRecord Item,FPTTree*& NewCurrent,FPTTree*& LastBrother)
{
bool found,over;
found = false;
over = false;
LastBrother = NULL;

	while ((NewCurrent != NULL) && (!found) && (!over))
	{
		if (NewCurrent->Element == Item.Element)
		found = true;
		else if (F1_Items[FindInHashTable[Item.Element]].COFIFrequency > F1_Items[FindInHashTable[NewCurrent->Element]].Frequency)
		over = true;
		else 
		{
			LastBrother = NewCurrent;
			NewCurrent  = NewCurrent->brother;
		}
	} // End while ((Current != NULL) && (!found))


return found;
} // End bool SearchFTPBrother(NewTransactionArray[i],Current,NewCurrent)

void AddNewChildWithBrother(struct TransactionRecord item,FPTTree* FatherNode,FPTTree* LastBrother,FPTTree*& NewCurrent)
{

	FPTTree* node = new FPTTree;
	node->Element = item.Element;
	node->child = NULL;
	node->next = NULL;
	node->counter = 1;
	node->father = FatherNode;
	
	if (LastBrother == NULL)
	{
	node->brother = FatherNode->child;		
	FatherNode->child = node;
	}
	else
	{
		node->brother = LastBrother->brother;	
		LastBrother->brother = node;
	}
	NewCurrent = node;

}

void AddNewChildNoBrother(struct TransactionRecord item,FPTTree* FatherNode,FPTTree*& NewCurrent)
{
	FPTTree* node = new FPTTree;
	node->Element = item.Element;
	node->brother = NULL;	
	node->child = NULL;		
	node->next = NULL;
	node->counter = 1;
	node->father = FatherNode;
	FatherNode->child = node;
	NewCurrent = node;
}

void AddCOFINewChildWithBrother(long item,COFITree* FatherNode,COFITree* LastBrother,COFITree*& NewCurrent, long branchsupport)
{

	NewCurrent = (COFITree* )malloc(sizeof(COFITree));
	NewCurrent->Element = item;
	NewCurrent->child = NULL;	
	NewCurrent->next = NULL;
	NewCurrent->counter = branchsupport;
	NewCurrent->father = FatherNode;	
	NewCurrent->participation = 0;
	if (LastBrother == NULL)
	{
	NewCurrent->brother = FatherNode->child;		
	FatherNode->child = NewCurrent;
	}
	else
	{
		NewCurrent->brother = LastBrother->brother;	
		LastBrother->brother = NewCurrent;
	}
}


void AddCOFINewChildNoBrother(long item,COFITree* FatherNode,COFITree*& NewCurrent, long branchsupport)
{

	NewCurrent = (COFITree* )malloc(sizeof(COFITree));
	NewCurrent->Element = item;
	NewCurrent->child = NULL;	
	NewCurrent->brother = NULL;
	NewCurrent->next = NULL;
	NewCurrent->counter = branchsupport;
	NewCurrent->father = FatherNode;
	NewCurrent->participation = 0;
	FatherNode->child = NewCurrent;


}

void AddFrequentNewChildWithBrother(long item,FrequentTree* FatherNode,FrequentTree* LastBrother,FrequentTree*& NewCurrent, long branchsupport, long depth)
{

	NewCurrent = (FrequentTree* )malloc(sizeof(FrequentTree));
	sprintf(NewCurrent->text, "%s %ld",FatherNode->text,item);
	NewCurrent->Element = item;
	NewCurrent->child = NULL;
	NewCurrent->depth = depth;
	NewCurrent->next = NULL;
	NewCurrent->counter = branchsupport;
	NewCurrent->father = FatherNode;	

		if (LastBrother == NULL)
	{
	NewCurrent->brother = FatherNode->child;		
	FatherNode->child = NewCurrent;
	}
	else
	{
		NewCurrent->brother = LastBrother->brother;	
		LastBrother->brother = NewCurrent;
	}
}


void AddFrequentNewChildNoBrother(long item,FrequentTree* FatherNode,FrequentTree*& NewCurrent, long branchsupport,long depth)
{

	NewCurrent = (FrequentTree* )malloc(sizeof(FrequentTree));
	sprintf(NewCurrent->text, "%s %ld",FatherNode->text,item);
	NewCurrent->Element = item;
	NewCurrent->depth = depth;
	NewCurrent->brother = NULL;
	NewCurrent->child = NULL;		
	NewCurrent->next = NULL;
	NewCurrent->counter = branchsupport;
	NewCurrent->father = FatherNode;
	FatherNode->child = NewCurrent;
	
}

void UpdateTable(struct TransactionRecord item,FPTTree*& NewCurrent)
{
	int loc = item.Index;
	
		if (F1_Items[loc].first == NULL)
			F1_Items[loc].first = NewCurrent;
		 else
			{
				NewCurrent->next = F1_Items[loc].first;
				F1_Items[loc].first= NewCurrent;
			}

}

void UpdateCOFITable(long item,COFITree*& NewCurrent,long branchsupport)
{
	long loc = FindInHashTable[item];
	
		if (F1_Items[loc].firstCOFI  == NULL)
			F1_Items[loc].firstCOFI = NewCurrent;
		 else
			{
				NewCurrent->next = F1_Items[loc].firstCOFI ;
				F1_Items[loc].firstCOFI =NewCurrent;
			}
}

void AddToFTPTree(struct TransactionRecord Item,FPTTree*& Current,FPTTree* LastBrother,FPTTree* Fathernode)
{
	if (Fathernode->child == NULL)
			AddNewChildNoBrother(Item,Fathernode,Current);
	else
	{
			AddNewChildWithBrother(Item,Fathernode,LastBrother,Current);

	}
	 UpdateTable(Item,Current);
} // End AddToFTPTree(NewTransactionArray[i],FPTTree*& Current);

void AddToCOFITree(long Item,COFITree*& Current,COFITree* LastBrother,COFITree* Fathernode, long branchsupport)
{
	if (Fathernode->child == NULL)
			AddCOFINewChildNoBrother(Item,Fathernode,Current,branchsupport);
	else
	{
			AddCOFINewChildWithBrother(Item,Fathernode,LastBrother,Current,branchsupport);
	}
	 UpdateCOFITable(Item,Current,branchsupport);
} // End AddToFTPTree(NewTransactionArray[i],FPTTree*& Current);

void AddToFrequentTree(long Item,FrequentTree*& Current,FrequentTree* LastBrother,FrequentTree* Fathernode, long branchsupport, long depth)
{
	if (Fathernode->child == NULL)
			AddFrequentNewChildNoBrother(Item,Fathernode,Current,branchsupport,depth);
	else
				AddFrequentNewChildWithBrother(Item,Fathernode,LastBrother,Current,branchsupport,depth);
} // End AddToFTPTree(NewTransactionArray[i],FPTTree*& Current);


void ScanForLocation(int& sizeofFrequent)
{
		int i,j;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产ts人妖一区二区| 亚洲中国最大av网站| 一本一道久久a久久精品综合蜜臀| 亚洲精品国产无套在线观 | 777奇米成人网| 国产成人av福利| 肉色丝袜一区二区| 亚洲蜜臀av乱码久久精品| 精品国产免费一区二区三区香蕉| 一本久道久久综合中文字幕| 国产成人亚洲综合a∨婷婷| 日韩激情av在线| 亚洲国产一二三| 亚洲欧洲av在线| 久久久久88色偷偷免费| 欧美一区在线视频| 欧日韩精品视频| av福利精品导航| 成人黄色在线看| 国产精品一二二区| 美女诱惑一区二区| 日韩影视精彩在线| 天天av天天翘天天综合网| 亚洲精品国产a| 亚洲欧美一区二区三区孕妇| 国产精品视频麻豆| 国产精品无人区| 国产午夜亚洲精品不卡| 精品久久国产字幕高潮| 欧美日韩免费在线视频| 色综合久久66| 日本福利一区二区| 91美女福利视频| 91尤物视频在线观看| 99久久国产免费看| 99久久久久免费精品国产| 北条麻妃国产九九精品视频| 成人18精品视频| 99精品视频一区二区三区| 99在线精品视频| 99久久精品国产麻豆演员表| 91丨九色丨黑人外教| 日本电影欧美片| 欧美日韩国产一级| 91精品黄色片免费大全| 日韩欧美一区二区在线视频| 91精品国产麻豆国产自产在线| 91精品在线观看入口| 日韩欧美123| 久久婷婷成人综合色| 国产亚洲一本大道中文在线| 国产精品美女一区二区三区| 亚洲色图色小说| 一区二区三区自拍| 亚洲成人av电影| 久久成人免费网站| 国产精品影视网| 成人a免费在线看| 欧美在线观看18| 欧美一级专区免费大片| 精品国产91久久久久久久妲己 | 久久久久久久久99精品| 亚洲国产精品精华液ab| 亚洲伦理在线精品| 午夜久久久久久电影| 国内精品久久久久影院一蜜桃| 成人自拍视频在线观看| 在线亚洲免费视频| 欧美一级高清大全免费观看| 久久精品视频免费观看| 亚洲同性gay激情无套| 日韩和欧美的一区| 国产成人欧美日韩在线电影| 色www精品视频在线观看| 日韩视频在线一区二区| 国产日产欧美精品一区二区三区| 亚洲黄色性网站| 精品亚洲成a人| 日本电影欧美片| 久久久777精品电影网影网| 亚洲欧美日韩精品久久久久| 日韩av在线播放中文字幕| 成人h动漫精品| 精品久久一区二区| 亚洲丝袜自拍清纯另类| 毛片av一区二区| 91在线观看一区二区| 精品福利av导航| 亚洲图片欧美综合| 国产精品91xxx| 91精品国产色综合久久ai换脸 | 日韩欧美一二三| 亚洲精品一二三区| 国产美女娇喘av呻吟久久| 欧美主播一区二区三区美女| 久久久精品天堂| 免费欧美日韩国产三级电影| 一本到不卡免费一区二区| 久久色在线观看| 日韩电影在线观看网站| 91免费国产视频网站| 久久久久久亚洲综合影院红桃| 午夜精品福利在线| av色综合久久天堂av综合| 亚洲精品一区二区三区影院 | 欧美成人国产一区二区| 一区二区三区精密机械公司| 成人免费看片app下载| 欧美成人激情免费网| 亚洲香肠在线观看| 99久久久久免费精品国产| 久久久久久久久久久久久女国产乱| 午夜成人免费视频| 91福利视频网站| 成人免费在线视频观看| 国产福利一区在线观看| 日韩免费看的电影| 午夜不卡在线视频| 欧美系列日韩一区| 一区二区三区波多野结衣在线观看 | 欧美日韩一级二级| 亚洲女与黑人做爰| eeuss鲁片一区二区三区在线观看| 久久综合色之久久综合| 久久精品99久久久| 日韩欧美二区三区| 男男成人高潮片免费网站| 欧美三级日韩在线| 亚洲午夜久久久久久久久久久 | 久久综合色综合88| 久久av老司机精品网站导航| 日韩一级片在线播放| 日本女人一区二区三区| 欧美在线看片a免费观看| 一区二区三区加勒比av| 欧美网站大全在线观看| 亚洲成人先锋电影| 欧美浪妇xxxx高跟鞋交| 午夜免费久久看| 日韩一级黄色大片| 日韩黄色免费网站| 日韩欧美国产电影| 国产精品一卡二卡在线观看| 国产午夜精品美女毛片视频| 国产成人av资源| 亚洲三级小视频| 欧美日韩国产小视频| 免费成人av在线| 国产无人区一区二区三区| 成人av综合一区| 一级做a爱片久久| 欧美精品在线观看一区二区| 狠狠色狠狠色合久久伊人| 国产女人aaa级久久久级| 91在线视频观看| 亚洲sss视频在线视频| 日韩亚洲欧美中文三级| 国产激情一区二区三区四区| 中文字幕日韩欧美一区二区三区| 色妞www精品视频| 日韩精品91亚洲二区在线观看| 精品国产伦一区二区三区免费| 丁香六月久久综合狠狠色| 亚洲免费av观看| 日韩欧美一二三四区| 成人av在线网| 午夜国产精品一区| 久久久久久久网| 91福利视频久久久久| 久久精品国产精品亚洲综合| 欧美国产激情二区三区| 欧美日韩在线播放三区四区| 久久国产精品色| 国产精品久久久久久久裸模| 欧美猛男超大videosgay| 国产精品系列在线播放| 亚洲美女在线国产| 精品剧情v国产在线观看在线| 91影视在线播放| 美女网站在线免费欧美精品| 国产精品久久久久久久久动漫 | 亚洲欧美激情小说另类| 日韩欧美区一区二| 一本久久精品一区二区| 精品在线亚洲视频| 一区二区三区在线免费视频| 国产日韩欧美制服另类| 欧美日韩精品免费观看视频| 国产成人高清在线| 日本三级亚洲精品| 日韩美女精品在线| www国产精品av| 欧美日韩免费一区二区三区视频| 国产盗摄一区二区三区| 日本一不卡视频| 自拍偷拍亚洲综合| 久久久高清一区二区三区| 久久久久久久久久久电影| 欧美亚洲综合色| 成人免费高清在线观看|