I have a problem with vector data type. After using community structure detection algorithm, I got the membership of vertices. This information is written into file.
So I extract membership information from the file, and assign them to a vector. The code is in the following:
..........
for(j=0; j<nodes; j++) // nodes is the number of nodes in the graph
{
igraph_vector_set( &membership, j, (double) member [j] ); // member array stores the membership of vertices
printf( "%f\n", (double)VECTOR(membership)[j] );
}
igraph_modularity( &graph, &membership, &modu, NULL );
The vector membership is initialized correctly. But when running igraph_modularity() function, it reports the following errors:
*** glibc detected *** ./modularity: malloc(): memory corruption (fast): 0x08084318 ***
======= Backtrace: =========
/lib/i686/nosegneg/libc.so.6[0x45dbfc6e]
/lib/i686/nosegneg/libc.so.6(__libc_calloc+0x94)[0x45dc0874]
/usr/local/lib/libigraph.so.0(igraph_vector_init+0x33)[0xeb1143]
/usr/local/lib/libigraph.so.0(igraph_modularity+0x5f)[0xf0600f]
./modularity[0x8048980]
/lib/i686/nosegneg/libc.so.6(__libc_start_main+0xdc)[0x45d6ddec]
./modularity[0x8048691]
So, I am a bit confused. Where is wrong?
--
Thanks
zhengjun
Graduate research assistant
Dept of Computer Science and Engineering
Lehigh University