www.pudn.com > fp_growth_source.rar > FPGrowth.java


package association.fptree; 
 
import java.io.*; 
import java.util.LinkedList; 
import association.fptree.ITree.Node; 
/** 
 * FP_growth算法 
 * @author qjt 
 * 
 */ 
public class FPGrowth { 
    int minSupport=1; 
    CreateFPTree ct; 
    ITree iTree;                                         //存储挖掘出的所有项集的树 
    FPGrowth(){ 
    	ct=new CreateFPTree(); 
    } 
    /*主程序*/ 
    public void Start(FPTree tree,ITree itr,int supp){ 
    	iTree=itr; 
    	minSupport=supp; 
    	FP_growth(tree,itr.head); 
    } 
    /** 
     * fp-growth算法 
     * @param  tree   FPtree 
     * @param  head   频繁项集树的头结点 
     * */ 
public void FP_growth(FPTree tree,LinkedList head){ 
    	FPTree           branch;                     //条件FPTree 
    	String           itemName; 
    	int              len,i=0,count; 
    	LinkedList l,cl; 
    	ITree            itr=new ITree(); 
    	ITree.Node       node; 
  
    	l=head; 
    	len=tree.itemTb.Length(); 
    	while(i(); 
    	    node.cNode=cl; 
    		FP_growth(branch,cl); 
    		branch=null; 
    	    i++; 
    	} 
    } 
}