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


C++ Graph::InitClustering方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
	FunctionNum = new int[numVerts];
	FunctionSize = new int[NumFunctions];
	GetProteinNames(nameFilename);
	
	whichCluster = new int[numVerts];
	AlreadyCounted = new bool[numVerts];
	ComplexSize = new int[numberOfComplexes];
	numberMatched = new int[numberOfComplexes];
	
	numClust = CountClusters(clusteringFilename);
	ClusterSize = new int[numClust];
	ClusterDensity = new float[numClust];
	ComplexDensity = new float[numberOfComplexes];
	
	ClusterP = new double[numClust];
	ComplexP = new double[numberOfComplexes];
	ComplexPee = new double[numberOfComplexes];
	
	ClusterFunction = new int[numClust];
	ComplexFunction = new int[numberOfComplexes];
	
	ClusterMatched = new bool[numClust];
	ComplexMatched = new bool[numberOfComplexes];
	ClusterSMatched = new bool[numClust];
	ComplexSMatched = new bool[numberOfComplexes];
	
	MainInComplex = new int[numberOfComplexes];
	MainInCluster = new int[numClust];
	UnknownInComplex = new int[numberOfComplexes];
	UnknownInCluster = new int[numClust];
	
	
	ComplexList = new SLList[numberOfComplexes];
	
	MaxMatch = new int[numClust];
	MaxMatchPct = new float[numClust];
	MaxMatchWith = new int[numClust];
	MaxMatchPctWith = new int[numClust];
	for(int clust = 1; clust < numClust; clust++){
		MaxMatch[clust]=0;
		MaxMatchPct[clust]=0;
		MaxMatchWith[clust]=0;
		MaxMatchPctWith[clust]=0;
	}
	
	
	ReadClustering(clusteringFilename);
	graph.SetNumClust(numClust);
	
	//printf("%d clusters....\n",(int) graph.NUM_CLUST);
	
	graph.MakeGraph(graphFilename);
	graph.CheckAdjList();
	graph.FillAdjList();
	
	graph.InitClustering(whichCluster);
	//graph.SetInitialNumAndDom();
	
	//Matching criteria
	//ComplexCutoff=.7; ClusterCutoff=.7;
	//ComConCutoff=1.1; CluConCutoff=.9;
	
	//ReadComplexes(complexFilename);
	
	
	//	GenVertexPermutation(graph.Order);
	
	//GetComplexP();
	GetClusterP();
	
	//	Match();
	
	GetStats();
	
	
  	//WriteData(outputFilename);
	
	printf("\n");
	WriteVerbalData2(outputFilename);
	
	//printf("PARAMS: %d %f %f\n",	sizeCutoff,densityCutoff, pCutoff);
	
	
	//WriteComposition(outputFilename);
	
	/*
	 for(int clust=0; clust<numClust; clust++){
	 if(!ClusterMatched[clust]){
	 printf("Cluster %d unmatched. Tops are %d/%d with %d (size %d) and %f with %d (size %d).\n",
	 clust, MaxMatch[clust], (int) graph.ClusterSize[clust],
	 MaxMatchWith[clust], ComplexSize[MaxMatchWith[clust]],
	 MaxMatchPct[clust], MaxMatchPctWith[clust],
	 ComplexSize[MaxMatchPctWith[clust]]);
	 }
	 
	 }
	 */
	
	return 0;
}
开发者ID:BioinformaticsArchive,项目名称:SurpriseMe,代码行数:101,代码来源:form.cpp

示例2: RunExperiment

// RunExperiment performs a single experiment of RNSC. See Fig 3.1 in my
// Master's thesis for an explanation.
void Experiment::RunExperiment(Graph& graph)
{


   if(!P_SkipNaive){//Run the naive scheme.

      if(SILENCE<=2) printf("\tRunning naive scheme....\n");

      //Initialize the clustering C_0 for the experiment.
      graph.InitClustering();

      //Initialize the naive move scheme, i.e. MoveList, NaiveCost,
      //FirstWithCost, NumWithCost, MoveListPtr.
      graph.InitNaiveScheme();
		
      //Set the best clustering to the initial clustering.
      BestNaiveCost = graph.NaiveCost;
      for(int i=0; i<graph.Order; i++){
	 ClusteringS[i] = graph.WhichCluster[i];
      }

      //Run the naive scheme.
      if(SILENCE<=1) printf("\t\tInitial naive cost  \t=%14d\n",BestNaiveCost);
      RunNaiveScheme(graph);
      if(SILENCE<=1) printf("\t\tFinal naive cost    \t=%14d\n", BestNaiveCost);
		
      //Delete the move list.
      graph.PurgeMoveList();

      //if(SILENCE<=1) printf("%d\t",graph.LoadClustering(ClusteringS));
      //Adjust the clustering, i.e. set the graph's current clustering to C_n.
      graph.InitClustering(ClusteringS);

   } else {//the naive scheme was not run.
      //We need to initialize the clustering C_0 for the experiment.
      //That is, we don't run the naive scheme, so C_n = C_0.
      graph.InitClustering();
   }

   if(P_ScaledStoppingTol > 0){//Run the scaled scheme.
      if(SILENCE<=2) printf("\tRunning scaled scheme....\n");

      //Initialize the scaled move scheme, i.e. MoveList, ScaledCost,
      //FirstWithCost, NumWithCost, MoveListPtr.
      graph.InitScaledScheme();
		
      //Set the best clustering to the initial clustering, i.e. C_s := C_n.
      BestScaledCost = graph.ScaledCost;
      for(int i=0; i<graph.Order; i++){
	 ClusteringS[i] = graph.WhichCluster[i];
      }


      //Run the scaled scheme.
      if(SILENCE<=1) printf("\t\tInitial scaled cost \t= %13.3f\n", BestScaledCost);
      RunScaledScheme(graph);
      if(SILENCE<=1) printf("\t\tFinal scaled cost   \t= %13.3f\n", BestScaledCost);
		
      //Clean up the scaled move scheme.
      graph.PurgeMoveList();

      //if(SILENCE<=1) printf("     %d\n",graph.LoadClustering(ClusteringS));
      //Adjust the clustering, i.e. set the graph's current clustering to C_s.
      graph.InitClustering(ClusteringS);

   } else {//The scaled scheme is not run. Get the scaled cost for C_n.
      BestScaledCost = graph.GetScaledCostForClustering();
   }

}
开发者ID:BioinformaticsArchive,项目名称:SurpriseMe,代码行数:72,代码来源:experiment.cpp


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