[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Question about vector
From: |
Tamas Nepusz |
Subject: |
Re: [igraph] Question about vector |
Date: |
Fri, 15 Jan 2010 10:30:52 +0000 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi,
Please send a full code that reproduces the error. It might have
happened that your membership vector is not initialized properly for
instance. By the way, there is an easier way to treat a C array as an
igraph_vector_t, see:
http://igraph.sourceforge.net/doc-0.5/html/ch06s02s05.html
Make sure that you neither modify nor destroy vectors created this way.
Modifying the underlying array is fine.
--
Tamas
> 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
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help