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 <mtgl/util.hpp>
00022 #include <mtgl/metrics.hpp>
00023
00024 using namespace mtgl;
00025
00026 #ifndef GET_FREQ
00027 #define GET_FREQ
00028
00029 double get_freq()
00030 {
00031 #ifdef __MTA__
00032 double freq = mta_clock_freq();
00033 #else
00034 double freq = 1000000;
00035 #endif
00036 return freq;
00037 }
00038 #endif
00039
00040 template <typename graph>
00041 void test_find_degree_degree_correlation(graph& g)
00042 {
00043 int ord = num_vertices(g);
00044 int size = num_edges(g);
00045 int maxdegree = (int) ceil(log(2. * ord - 1) / log(2.)) + 1;
00046
00047 double** result = (double**) malloc(maxdegree * sizeof(double*));
00048
00049 #pragma mta assert parallel
00050 for (int i = 0; i < maxdegree; ++i)
00051 {
00052 result[i] = (double*) malloc(maxdegree * sizeof(double));
00053 }
00054
00055 find_degree_degree_correlation<graph> fddc(g, result);
00056 int ticks1 = fddc.run();
00057 fprintf(stdout, "degree degree correlation:\n\t");
00058
00059 for (int j = 1; j < maxdegree; ++j) fprintf(stdout, "%6d ", j);
00060
00061 fprintf(stdout, "\n");
00062
00063 for (int i = 1; i < maxdegree; ++i)
00064 {
00065 fprintf(stdout, "%7d ", i);
00066
00067 for (int j = 1; j < maxdegree; ++j) fprintf(stdout, "%.4lf ", result[i][j]);
00068
00069 fprintf(stdout, "\n");
00070 }
00071
00072 for (int i = 0; i < maxdegree; ++i) free(result[i]);
00073 free(result);
00074 }