void matcher::calc_sim_nodes_alpha(int i) { int top_idx = 1; for (int j=1; j<=G->num_nodes; j++) if (last_round[i][j] >= ALPHA) calc_sim_nodes(i, j, 1); else sim_nodes[i][j] = last_round[i][j]; }
void matcher::gen_sim_matrix_simranc() { clock_t time_start = clock(); for (int i=1; i<=G_a->num_nodes; i++) for (int j=1; j<=G->num_nodes; j++) sim_nodes[i][j] = 1; #if MULTITHREAD for (int i=1; i<=G_a->num_nodes; i++) G_a->extract_subgraph(i); for (int i=1; i<=G->num_nodes; i++) G->extract_subgraph(i); #endif for (cT=0; cT++ < MAX_ROUNDS; ) { fprintf(stderr, "Processing round %d ... \r", cT); // update node similarities for every pair of nodes memcpy(last_round, sim_nodes, sizeof(sim_nodes)); #if MULTITHREAD MTCR = this; for (int i=0; i<THREAD_POOL_SIZE; i++){ args[i] = i; pthread_create(threads+i, NULL, calc_sim_nodes_pthread, args+i); } for (int i=0; i<THREAD_POOL_SIZE; i++) pthread_join(threads[i], NULL); #else #ifndef BASELINE for (int i=1; i<=G_a->num_nodes; i++) calc_sim_nodes_alpha(i); #else for (int i=1; i<=G_a->num_nodes; i++) for (int j=1; j<-=G->num_nodes; j++) calc_sim_nodes(i, j, 1); #endif #endif fprintf(stderr, "Round %d processed\n", cT); } fprintf(stderr, "matcher info:\t%d rounds, %.2lf seconds.\n", MAX_ROUNDS, (clock()-time_start)*1.0/CLOCKS_PER_SEC); }
void matcher::calc_sim_nodes_singleth(int i, int j, bool flag){ if (flag) calc_sim_nodes(i, j, 2); else calc_sim_nodes(i, j, 1); }