コード例 #1
0
int main(int argc, char **argv)
{
  char input_filename[NAMELENGTH+1];
  char quantityname[NAMELENGTH+1];
  char output_type[NAMELENGTH+1];
  int numberofbins, numberofbins_logbinned;

  if(argc > 3)
    {
      sprintf(input_filename, "%s", argv[1]);
      sscanf(argv[2], "%d", &numberofbins);
      sscanf(argv[3], "%d", &numberofbins_logbinned);
      printf("Number of bins for linear binning : %d\n", numberofbins);
      printf("Number of bins for logarithmic binning : %d\n", numberofbins_logbinned);

      readEdgeWeightData(input_filename);

      allocateMemoryForNodeAttribute(numberofnodes);
      determineNodeDegree(nodedegree, sourcenodeid, targetnodeid, numberofedges);

      sprintf(quantityname, "endpointdegree");
      sprintf(output_type, "edges");
      allocateMemoryForEdgeAttribute(numberofedges);
      determineEdgeDegree(edgedegree, sourcenodeid, targetnodeid, numberofedges, nodedegree);
      writeEdgeAttribute(edgedegree, numberofedges, quantityname, output_type);

      determineExtremumValuesOfDoubleTypeQuantity(&minedgedegree, &maxedgedegree, edgedegree, numberofedges);
      printf("Minimum edge-degree : %.0lf\n", minedgedegree);
      printf("Maximum edge-degree : %.0lf\n", maxedgedegree);

      sprintf(quantityname, "endpointdegree_averageweight.linbinned");
      sprintf(output_type, "plot");
      allocateMemoryForGlobalMeasurementLinearBinned(numberofbins);
      determineAverageQuantityWithRespectToDegreeLinearBinned(averageedgeweight, edgedegreedistribution, newedgedegree, 
								   edgeweight, minedgedegree, maxedgedegree, edgedegree, numberofedges, numberofbins);
      writeAverageQuantityBinned(averageedgeweight, edgedegreedistribution, newedgedegree, 
							  numberofbins, quantityname, output_type);
      sprintf(quantityname, "endpointdegree_averageweight.logbinned");
      sprintf(output_type, "plot");
      allocateMemoryForGlobalMeasurementLogarithmicBinned(numberofbins_logbinned);
      determineAverageQuantityWithRespectToDegreeLogarithmicBinned(averageedgeweight_logbinned, edgedegreedistribution_logbinned, newedgedegree_logbinned, 
								   edgeweight, minedgedegree, maxedgedegree, edgedegree, numberofedges, numberofbins_logbinned);
      writeAverageQuantityBinned(averageedgeweight_logbinned, edgedegreedistribution_logbinned, newedgedegree_logbinned, 
							       numberofbins_logbinned, quantityname, output_type);

      freeMemoryOfGlobalMeasurementLogarithmicBinned();
      freeMemoryOfGlobalMeasurementLinearBinned();
      freeMemoryOfEdgeAttribute();
      freeMemoryOfNodeAttribute();
    }
  else
    printf("Error: Insufficient number of inputs\n");
  return 0;
}
コード例 #2
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;
}