当前位置: 首页>>代码示例>>C++>>正文


C++ Tree::PrintTree方法代码示例

本文整理汇总了C++中Tree::PrintTree方法的典型用法代码示例。如果您正苦于以下问题:C++ Tree::PrintTree方法的具体用法?C++ Tree::PrintTree怎么用?C++ Tree::PrintTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tree的用法示例。


在下文中一共展示了Tree::PrintTree方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
    Tree *tree = new Tree();

    TreeNode *tn = tree->BuildTree();
    tree->PrintTree(tn, tree->InOrder);

//	tree->InvertBinaryTree(tn);
//	tree->PrintTree(tn, tree->InOrder);

    LevelOrderTraversal(tn);
		
}
开发者ID:i2ali,项目名称:SampleCode,代码行数:13,代码来源:Trees.cpp

示例2: main


//.........这里部分代码省略.........
				printf("Ungapped Alignment\n");
			else
				printf("Gap open = %.3lf, gap extend = %.3lf\n", gapOpen, gapExtend);
		}
	}else{
		printf("No input motifs provided!\n\n");
	}
	if(genRandMotifs){
		//Generate some random matrices
		RandPSSMGen* RPG = new RandPSSMGen(Plat->inputMotifs, Plat->GetMatCount(), 10000, randMatOut);
		RPG->RunGenerator();
	}
	if(genRandScores){
		//Find rand dist
		Plat->GetRandDistrib(scoresOut, ALIGN);
	}else if(!scoresProvided){
		printf("No score distribution file provided!\n\n");
	}
	if(testing){
		PlatformTesting* PT = new PlatformTesting(CC);
		//Print the distribution of column depth
	//	PT->ColumnDepthDist(Plat->inputMotifs, Plat->GetMatCount());
		//Print the similarities of all columns against all others
	//	PT->ColumnScoreDist(Plat->inputMotifs, Plat->GetMatCount(), 0.05);
		double z;
		for(z=0.25; z<0.8; z+=0.05)
			PT->RandColumns(Plat, z);
		for(z=0.8; z<=1.0; z+=0.01)
			PT->RandColumns(Plat, z);
		delete(PT);
	}

	if(scoresProvided || preAlign){

		Plat->ReadScoreDists(scoreDist);
		if(!silent && !htmlOutput){printf("Scores read\n");}
		if(Plat->GetMatCount()>1){
			if(preAlign){
				//No alignments or trees built here
				pssmAlignment = MA->PreAlignedInput(Plat);
			}else{
				//Multiple alignment procedure
				Plat->PreAlign(ALIGN);
				if(pairwiseOnly){
					if(!silent && !htmlOutput){printf("\nPairwise alignment scores:\n");}
					Plat->PrintPairwise();
				}if(!ma_off){
					MA->ImportBasics(Plat, ALIGN);
					if(!silent && !htmlOutput){printf("Alignments Finished\n");}
					if(!testingAcc){
						if(tree_loocv && testingTree){
							T->LOOCVBuildTree(Plat, testingTree);
						}else{
							if(testingTree && !silent && !htmlOutput){printf("Calinski & Harabasz:\n\tNumClust\tC&H_Metric\n");}
							T->BuildTree(Plat, testingTree);
							if(!silent && treeClusts){printf("The Calinski & Harabasz statistic suggests %.0lf clusters in the input motifs\n", T->GetNodesMinCH());}
							if(printTreeClusts){
								T->PrintLevel(outFileName, int(T->GetNodesMinCH()));
							}
						}
						T->PrintTree(outFileName);

						if(!silent && !htmlOutput){printf("Tree Built\n");}

						if(!silent){
							if(!silent && !htmlOutput){printf("Multiple Alignment:\n");}
							pssmAlignment = MA->BuildAlignment(Plat, ALIGN, T);
						}
					}
				}
			}

			//Experiment with the Protein Domains
			if(usingDomains){
				PROTS = new ProteinDomains();
				PROTS->ReadDomains(inputProteins, Plat->inputMotifs, Plat->GetMatCount());
				PROTS->MutualInformation(pssmAlignment, MA->Alignment2Profile(pssmAlignment, "AlignmentMotif"), Plat->inputMotifs, Plat->GetMatCount());
				delete PROTS;
			}
		}
		//Similarity match against the database
		if(simMatching){
			Plat->ReadTransfacFile(matchTFs, famNames, false, false);
			Plat->SimilarityMatching(ALIGN, outFileName, famNames, matchTopX);
		}
	}

	if(testingAcc && scoresProvided && inputProvided && Plat->GetMatCount()>1){
		PlatformTesting* PT = new PlatformTesting(CC);
		PT->PairwisePredictionAccuracy(Plat);
	}

	delete(MA);
	delete(T);
	delete(CC);
	delete(ALIGN);
	}
delete(Plat);
return(0);
}
开发者ID:razZ0r,项目名称:STAMP,代码行数:101,代码来源:main.cpp

示例3: main

//use mainly as a driver function
int main () //Author: Alexi
{
	Tree *itemTree; 
	itemTree = new Tree();
	
	/*
	int testChoice;
	instructions();
	cin>>testChoice;
	//driver test function
	switch (testChoice) 
	{
	case 0: 
	  {
	    ItemPtr L1 = new Item("L1");
	    ItemPtr L2 = new Item("L2");
	    ItemPtr M2 = new Item("M2");
	    ItemPtr L2_2 = new Item("L2");
	    
	    cout<<"Compare " << (L1->getName()) << " and " << (L2->getName()) <<": "<< L1->id_compare(L2) << endl; //should return -1
	    cout<<"Compare M2 and L2: "<< M2->id_compare(L2)<<endl; //should return 1
	    cout<<"Compare L2 and L2: "<< L2->id_compare(L2_2) <<endl; //should return 0
	  }
	  break;
	case 1: //Test store_compare
	  cout << "store_compare test here\n";
	  {
	    Store s0 = {0,0,0, 4, NULL};
	    Store s1 = {1, 1, 1, 3, NULL};
	    Store s2 = {2, 2, 1, 3, NULL};
	    Store s3 = {1, 1, 1, 3, NULL};

	    cout<<"Compare 4 items and 3 items: "<<store_compare(&s0, &s1) << endl;
	    cout<<"Compare 3 items and 4 items: "<<store_compare(&s1, &s0)<<endl;
	    cout<<"Compare 3 items and 3 items (diff location): "<<store_compare(&s1, &s2)<<endl;
	    cout<<"Compare 3 items and 3 items (same location): "<<store_compare(&s1, &s3)<<endl;
	  }
	  break;
	case 2: //test addItem. Seems to work fine
	  cout<<"\nTesting addItem\n";
		{
		ItemPtr L1 = new Item("L1");
	    ItemPtr L2 = new Item("L2");
	    ItemPtr M2 = new Item("M2");
	    ItemPtr L2_2 = new Item("L2");
		ItemPtr A7 = new Item("A7");
	    ItemPtr S2 = new Item("S2");
		
		Store s0 = {0,0,0, 4, NULL};
	    Store s1 = {1, 1, 1, 3, NULL};
	    Store s2 = {2, 2, 1, 3, NULL};
	    Store s3 = {1, 1, 1, 3, NULL};
		
		cout << "Testing item:\n";
		L1->printItem();
		L2->printItem();
		M2->printItem();
		cout << "Adding to tree\n";
		
		itemTree->addItem(L2, &s0);
		cout<<"Added first successfully\n";
		cout << "Printing Tree:\n\n";
		itemTree->PrintTree();
		
		itemTree->addItem(M2, &s1);
		cout<<"Added second successfully\n";
		cout << "Printing Tree:\n\n";
		itemTree->PrintTree();
		
		itemTree->addItem(L1, &s2);
		cout<<"Added third successfully\n";
		cout << "Printing Tree:\n\n";
		itemTree->PrintTree();
		
		itemTree->addItem(L2_2, &s3);
		cout<<"Added fourth successfully\n";
		cout << "Printing Tree:\n\n";
		itemTree->PrintTree();
		
		itemTree->addItem(A7, &s2);
		cout<<"Added fourth successfully\n";
		cout << "Printing Tree:\n\n";
		itemTree->PrintTree();
		
		itemTree->addItem(S2, &s2);
		cout<<"Added fifth successfully\n";
		cout << "Printing Tree:\n\n";
		itemTree->PrintTree();
		}
		break;
	case 3: //tests basic addStore
	  cout << "\nTesting addStore\n";
	  {
	    ItemPtr L1 = new Item("L1");
	    ItemPtr L2 = new Item("L2");
	    ItemPtr M2 = new Item("M2");
	    ItemPtr L2_2 = new Item("L2");
	    
	    Store s0 = {0,0,0, 4, NULL};
//.........这里部分代码省略.........
开发者ID:anachronism,项目名称:Project4_CS2303,代码行数:101,代码来源:prog4.cpp


注:本文中的Tree::PrintTree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。