igraph-help
[Top][All Lists]
Advanced

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

[igraph] Question about vector


From: zhengjun chen
Subject: [igraph] Question about vector
Date: Thu, 14 Jan 2010 22:17:00 -0500

Hi,

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.
Then I want to calculate the modularity for this community division. 
So I extract membership information from the file, and assign them to a vector. The code is in the following:  
     
     int member[12000] ;
     ..........
     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

reply via email to

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