igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] help need for the fast community detection algorithm


From: Xing Jiang
Subject: [igraph] help need for the fast community detection algorithm
Date: Thu, 26 Jul 2007 16:06:58 +0800

Hi All,

I am now using igraph for community structure detection. I write a very simple program to call the igraph library. I want to see what the result is on the club graph shown in the example. However, I see this algorithm does not work and no partition performed.

the graph I want to test have 8 edges.Its structure  is like 

      1                 5
0          3 ------4       7
     2                  6


node {0, 1, 2,3} & {4,5,6,7} are two cliques.

It is supposed to have two sub structures detected. However, I do not obtain such results. I test on NewMan's code. it works. But igraph does not work.


thank you for your help!



the following code is the one i use:

int main(void){
    igraph_real_t modularity;
    igraph_integer_t vertexNumber = 8;
    igraph_integer_t edgeNumber = 13;
   
    igraph_vector_t edges;
    igraph_vector_t type;

    igraph_t graph;
   
    igraph_empty(&graph, vertexNumber, IGRAPH_UNDIRECTED);

    igraph_vector_init(&edges, edgeNumber*2);

    VECTOR(edges)[0]=0;
    VECTOR(edges)[1]=1;
    VECTOR(edges)[2]=0;
    VECTOR(edges)[3]=2;
    VECTOR(edges)[4]=0;
    VECTOR(edges)[5]=3;
    VECTOR(edges)[6]=1;
    VECTOR(edges)[7]=2;
    VECTOR(edges)[8]=1;
    VECTOR(edges)[9]=3;
    VECTOR(edges)[10]=2;
    VECTOR(edges)[11]=3;
    VECTOR(edges)[12]=2;
    VECTOR(edges)[13]=4;
    VECTOR(edges)[14]=4;
    VECTOR(edges)[15]=5;
    VECTOR(edges)[16]=4;
    VECTOR(edges)[17]=6;
    VECTOR(edges)[18]=4;
    VECTOR(edges)[19]=7;
    VECTOR(edges)[20]=5;
    VECTOR(edges)[21]=6;
    VECTOR(edges)[22]=5;
    VECTOR(edges)[23]=7;
    VECTOR(edges)[24]=6;
    VECTOR(edges)[25]=7;
   
    igraph_add_edges(&graph, &edges,0);

    igraph_vector_init(&type,vertexNumber);

    igraph_modularity(&graph,&type, &modularity);
       
        igraph_integer_t zz = igraph_ecount(&graph);
   
    printf("edge: %d\n",(int)zz);

    printf("Modularity: %f\n",(double)modularity);
   
    igraph_vector_destroy(&edges);
    igraph_vector_destroy(&type);
    igraph_destroy(&graph);
   
    return 0;

}

--
regards
Jiang Xing
reply via email to

[Prev in Thread] Current Thread [Next in Thread]