0
votes

Please load the following function:

weight.community <- function(row,membership,weigth.within,weight.between) {
        if(as.numeric(membership[which(names(membership)==row[1])])==as.numeric(membership[which(names(membership)==row[2])])){
        weight=weigth.within
        }else{
        weight=weight.between
        }
        return(weight)
        }
dump(weight.community,"weight.community.R")
source("weight.community.R")

Now, here is my issue: with igraph<1.0.0, the following commands:

g=erdos.renyi.game(10,0.5)
V(g)$names=as.character(1:10)
membership=c(rep(1,5),rep(2,5))
names(membership)=V(g)$names
E(g)$weight=apply(get.edgelist(g),1,weight.community,membership,50,1)
g$layout=layout.fruchterman.reingold(g,weights=E(g)$weight)
plot(g)

used to give me a graph where vertices were grouped based on community membership (like shown in this thread). But in the new version of igraph, it seems that layout.fruchterman.reingold is not responsive to edge weights anymore. I tried the new function name layout_with_fr, with the same outcome. And the same thing happens with layout.kamada.kawai.

I know from these release notes that

Fruchterman-Reingold and Kamada-Kawai layout algorithms rewritten from scratch

So, that might explain me running into trouble. I would appreciate any guidance on how to approach this issue.

1

1 Answers

3
votes

This is probably a bug in the C core of igraph that was introduced in 1.0.0. If you look at the source code of layout_fr.c, you can see that the weights argument is not used anywhere in the layout functions.

Please file an issue on GitHub if you would like to get this fixed.