PS, one final command is the following, i.e. without any weights argument passed to the modularity function, gives this (so it’s the default output). I am wondering therefore what is the ‘right’ answer, 0.031 or 0.055, and what the difference is
> modularity(net,membership(cluster_leading_eigen(net, weights = E(net)$weight))) [1] 0.03061224
Hi Gabor,
Thanks for your reply.
Here are 4 different commands and their result, I guess I am just a bit confused how they relate to each other.
The first two are using the cluster_leading_eigen alone, the second two use that command to find the communities and then the modularity function to get the modularity value out of it
Would I be right in understanding that cluster_leading_eigen only uses the weights argument after the communities have been found - but then why does it return the same value below for the first two commands - and why is it different to the third command
Thanks
> cluster_leading_eigen(net, weights = E(net)$weight) IGRAPH clustering leading eigenvector, groups: 2, mod: 0.055 + groups: $`1` [1] "YV" "B" "P"
$`2` [1] "DG" "V"
> cluster_leading_eigen(net, weights = NULL) IGRAPH clustering leading eigenvector, groups: 2, mod: 0.055 + groups: $`1` [1] "YV" "B" "P"
$`2` [1] "DG" "V"
> modularity(net,membership(cluster_leading_eigen(net, weights = E(net)$weight)),weights=NULL) [1] 0.03061224
> modularity(net,membership(cluster_leading_eigen(net, weights = E(net)$weight)),weights=E(net)$weight) [1] 0.0546875
IIRC the original algorithm can be extended easily to take weights into account. If you think the igraph is not doing that (and the docs say that it would), can you please provide a small example that gives you the same results with or without (large enough) weights? Thanks. Gabor On Wed, May 24, 2017 at 10:11 AM, Edmund Hunt < address@hidden> wrote: Hello,
I have a question/comment about the leading.eigenvector.community function in igraph
It has an argument for weights, but this seems to make no difference to the calculated clusters/resulting modularity
Indeed I don’t think Newman’s algorithm takes edge weights into account?
Is it the case that the weights are only used after the community detection has taken place, to calculate a modularity value? Is it appropriate to use the weights to calculate modularity, can anyone advise me what is the ‘right’ thing to do with a weighted, undirected network - is it definitely to use the weights in the modularity calculation, or is there a free choice
Perhaps these issues could be made clearer in the function help
Thanks
_______________________________________________ igraph-help mailing list address@hidden https://lists.nongnu.org/mailman/listinfo/igraph-help
_______________________________________________ igraph-help mailing list address@hiddenhttps://lists.nongnu.org/mailman/listinfo/igraph-help
|