igraph_community_label_propagation crashes if component has all negative initial values
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
igraph |
Fix Released
|
High
|
Gábor Csárdi |
Bug Description
The following R code:
library(igraph)
label.propagati
causes R to abort, with a Backtrace and Memory Map outputted. The top of the backtrace suggests that the issue is in the modularity calculation:
*** glibc detected *** /usr/lib64/
======= Backtrace: =========
/lib64/
/lib64/
~/R/x86_
11de681]
~/R/x86_
5a1e]
~/R/x86_
~/R/x86_
A similar issue can be achieved directly with
> modularity(
but note that
> modularity(
does not fail. It seems like this suggests that the issue was introduced when igraph switched from 0-indexing to 1-indexing, though I do not know for certain.
Related branches
Changed in igraph: | |
milestone: | none → 0.6.4 |
Changed in igraph: | |
status: | Fix Committed → Fix Released |
OK, I cannot really reproduce this on OSX, but I think I found the bug. Is this right, Tamas?
=== modified file 'src/community.c' community_ label_propagati on(c *initial) [i] < -1) { *initial) [i] <= -1) {
VECTOR( *membership) [i] = 0;
VECTOR( *membership) [i] = VECTOR(*initial)[i] + 1;
--- src/community.c 2012-11-19 20:30:26 +0000
+++ src/community.c 2013-02-01 01:58:56 +0000
@@ -1940,7 +1940,7 @@ int igraph_
}
/* Check if the labels used are valid, initialize membership vector */
for (i=0; i<no_of_nodes; i++) {
- if (VECTOR(
+ if (VECTOR(
} else {