Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <cmath>
00022
00023 #include <mtgl/util.hpp>
00024 #include <mtgl/metrics.hpp>
00025
00026 using namespace mtgl;
00027
00028 #ifndef GET_FREQ
00029 #define GET_FREQ
00030
00031 double get_freq()
00032 {
00033 #ifdef __MTA__
00034 double freq = mta_clock_freq();
00035 #else
00036 double freq = 1000000;
00037 #endif
00038 return freq;
00039 }
00040 #endif
00041
00042 template <typename graph>
00043 void test_find_degree_distribution(graph& g)
00044 {
00045 int ord = num_vertices(g);
00046 int size = num_edges(g);
00047 int maxdegree = (int) ceil(log(2. * ord - 1) / log(2.)) + 1;
00048 double* result = (double*) malloc(maxdegree * sizeof(double));
00049
00050 find_degree_distribution<graph> fdd(g, result, "dd_test.out");
00051 int ticks1 = fdd.run();
00052 fprintf(stdout, "degree distribution:\n");
00053
00054 for (int i = 0; i < maxdegree; ++i)
00055 {
00056 fprintf(stdout, "%2d %lf\n", i, result[i]);
00057 }
00058
00059 fprintf(stderr, "RESULT: find_degree_distrbution %lu (%6.2lf, 0)\n",
00060 size, ticks1/get_freq());
00061
00062 free(result);
00063 }