int main(int argc, char **argv)
{
	if(argc==1) PrintHelp();

	scaledCost = 0;
	
	time_t startTime;
	srand(time(&startTime));
	
	outputFilename = (char *)"output.txt";
	
	functionMapping = (char *)"UABCDEFGHIJKLMNOPQRSTVWXYZ";//"UEGMPTBFOARDC";
	
	sizeCutoff = 1; densityCutoff=0; pCutoff=1.000001;
	
	ReadParameters(argc, argv);
	
	printf("Graph filename:         %s\n",graphFilename);
	printf("Number of nodes:        %d\n\n",numVerts = ReadClusteringNumber(graphFilename));
	if(numVerts== -1){
		fprintf(stderr,"Graph input error.  File %s is nonexistent, unreadable, or not a valid graph file.  QUITTING.\n",graphFilename);
		printUsageError();
		return 0;		
	}
	
	
	printf("Clustering filename:    %s\n",clusteringFilename);
	printf("Number of clusters:     %d\n\n",numClust = ReadClusteringNumber(clusteringFilename));
	if(numClust == -1){
		fprintf(stderr,"Clustering input error.  File %s is nonexistent, unreadable, or not a valid clustering file.  QUITTING.\n",clusteringFilename);
		printUsageError();
		return 0;		
	}
	
	//printf("Number of complexes:  %d\n",numberOfComplexes = ReadClusteringNumber(complexFilename));
	
	
	printf("Protein name filename:  %s\n\n",nameFilename);
	
	
	
	NumFunctions = strlen(functionMapping);
	printf("%-3dfunctional groups:   %s\n\n",NumFunctions, functionMapping);
	
	printf("Prediction cutoffs:\n     Size    >= %d.\n     Density >= %-1.3f.\n     P-value <= %-.1e.\n\n",
		   sizeCutoff, densityCutoff, pCutoff);
	
	
	
	/* FIX COMPUTATION OF BEST P-VALUE.
	 * WRITE THE REST OF THE CHAPTER.*/
	
	
	//initialize the arrays.
	
	ComplexList = new SLList[numberOfComplexes];
	proteinName = new std::string[numVerts];
	Function = new char[numVerts];
	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;
}
// 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();
   }

}