Ejemplo n.º 1
0
int main(int argc, char **argv)
{
  char input_filename[NAMELENGTH+1];
  char quantityname[NAMELENGTH+1];
  char output_type[NAMELENGTH+1];

  if(argc > 1)
    {
      sprintf(input_filename, "%s", argv[1]);

      readEdgeWeightData(input_filename);

      allocateMemoryForNodeAttribute(numberofnodes);

      sprintf(quantityname, "degree");      
      sprintf(output_type, "nodes");
      determineNodeDegree(nodedegree, sourcenodeid, targetnodeid, numberofedges);
      writeIntegerTypeNodeAttribute(nodedegree, numberofnodes, quantityname, output_type);

      sprintf(quantityname, "strength");
      sprintf(output_type, "nodes");
      determineNodeStrength(nodestrength, sourcenodeid, targetnodeid, edgeweight, numberofedges);      
      writeDoubleTypeNodeAttribute(nodestrength, numberofnodes, quantityname, output_type);

      freeMemoryOfNodeAttribute();
    }
  else
    printf("Error: Insufficient number of inputs\n");
  return 0;
}
int main(int argc, char **argv)
{
  char input_filename[NAMELENGTH+1];
  char quantityname[NAMELENGTH+1];
  char output_type[NAMELENGTH+1];
  int numberofbins;

  if(argc > 2)
    {
      sprintf(input_filename, "%s", argv[1]);
      sscanf(argv[2], "%d", &numberofbins);

      readEdgeWeightData(input_filename);

      sprintf(quantityname, "clusteringcoefficient");
      sprintf(output_type, "nodes");
      allocateMemoryForNodeAttribute(numberofnodes);
      determineNodeDegree(nodedegree, sourcenodeid, targetnodeid, numberofedges);
      determineNodeStrength(nodestrength, sourcenodeid, targetnodeid, edgeweight, numberofedges);
      allocateMemoryForConnectivity(nodedegree, numberofnodes);
      constructConnectivity(nodeneighborid, nodeneighboredgeid, nodedegree, numberofnodes, sourcenodeid, targetnodeid, numberofedges);
      determineNodeClusteringCoefficient(nodeclusteringcoefficient, nodeneighborid, nodeneighboredgeid, nodedegree, nodestrength, numberofnodes, edgeweight);
      writeNodeAttribute(nodeclusteringcoefficient, numberofnodes, quantityname, output_type);

      determineExtremumValuesOfIntegerTypeQuantity(&minnodedegree, &maxnodedegree, nodedegree, numberofnodes);
      printf("Minimum node-degree : %d\n", minnodedegree);
      printf("Maximum node-degree : %d\n", maxnodedegree);

      sprintf(quantityname, "degree_averageclusteringcoefficient.linbinned");
      sprintf(output_type, "plot");
      allocateMemoryForGlobalMeasurementLinearBinned(minnodedegree, maxnodedegree);
      determineAverageQuantityWithRespectToDegreeLinearBinned(averagenodeclusteringcoefficient, nodedegreedistribution, nodeclusteringcoefficient, 
							      minnodedegree, maxnodedegree, nodedegree, numberofnodes);
      writeAverageQuantityWithRespectToDegreeLinearBinned(averagenodeclusteringcoefficient, nodedegreedistribution, minnodedegree, maxnodedegree, quantityname, output_type);

      sprintf(quantityname, "degree_averageclusteringcoefficient.logbinned");
      sprintf(output_type, "plot");
      allocateMemoryForGlobalMeasurementLogarithmicBinned(numberofbins);
      determineAverageQuantityWithRespectToDegreeLogarithmicBinned(averagenodeclusteringcoefficient_logbinned, nodedegreedistribution_logbinned, newnodedegree_logbinned, 
								   nodeclusteringcoefficient, minnodedegree, maxnodedegree, nodedegree, numberofnodes, numberofbins);
      writeAverageQuantityWithRespectToDegreeLogarithmicBinned(averagenodeclusteringcoefficient_logbinned, nodedegreedistribution_logbinned, newnodedegree_logbinned, 
 							       numberofbins, quantityname, output_type);

      freeMemoryOfGlobalMeasurementLogarithmicBinned();
      freeMemoryOfGlobalMeasurementLinearBinned();
      freeMemoryOfConnectivity(numberofnodes);
      freeMemoryOfNodeAttribute();
    }
  else
    printf("Error: Insufficient number of inputs\n");
  return 0;
}