Hello, Recently I am trying to running the walktrap algorithm and get the membership of the walktrap algorithm result, but I do not know how to get each value of membership from igraph_vector_int_t type. Basically I want to iterate the membership. The following are my code:
igraph_vector_t modularity;
igraph_matrix_int_t merges;
igraph_vector_int_t membership;
//igraph_vector_int_t membership;
igraph_vector_init(&modularity, 0);
igraph_vector_int_init(&membership, 0);
igraph_matrix_int_init(&merges, 0, 0);
rstCode = igraph_community_walktrap(&wbNetwork, &weights, 4, &merges, &modularity, /*membership=*/ &membership);
if(rstCode != 0){
printf("igraph_community_label_propagation running failed");
return -2;
}else{
printf("Success! \n");
printf("the total community number is:%g\n", (igraph_vector_int_max(&membership) + 1.0));
for(i=0;i<500;i++){
printf("Node: %d -> community: %g \n",i,VECTOR(membership)[i]);
}
}
and my output result is like this:
Node: 493 -> community: 48
Node: 494 -> community: 48
Node: 495 -> community: 48
Node: 496 -> community: 48
Node: 497 -> community: 48
Node: 498 -> community: 48
Node: 499 -> community: 48
I checked my result, there has different community, but on my output, its all same community. So how do I get the value from my membership?