Ah I see, thank you Szabolcs!

I am using several clustering methods available in igraph at once to compare 
outputs, so this is completely inconsistent between methods!!!

cluster_edge_betweenness - uses NULL to omit edge weights
cluster_fast_greedy - uses NULL to omit edge weights (though it is not clear on 
this point?)
cluster_label_prop - uses NA, but in the ‘usage’ states NULL
cluster_leading_eigen - uses NA, but in the ‘usage’ states NULL
cluster_louvain - uses NA, but in the ‘usage’ states NULL
cluster_optimal - uses NA, but in the ‘usage’ states NULL
cluster_walktrap - does not provide any guidance, I assumed NULL was used
cluster_spinglass - uses NA, but usage states NULL

I am still quite new to R so perhaps the ‘usage’ is meant to be read 
differently, but I thought it meant NULL could be used as a meaningful input

Please could this be fixed so there is a uniform and clear approach in the next 
update to igraph, as it is very confusing at present

Thanks,

Edmund

> On 25 May 2017, at 10:48, Szabolcs Horvát <[email protected]> wrote:
> 
> On 25 May 2017 at 19:43, Edmund Hunt <[email protected] <mailto:[email protected]>> 
> wrote:
>> 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"
> 
> 
> According to the documentation, you need to supply weights=NA, and not
> weights=NULL, to ignore any existing weight values in the graph.
> 
>> 
>>> 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
>> 
>> 
>> 
>> On 25 May 2017, at 06:51, Gábor Csárdi <[email protected]> wrote:
>> 
>> 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 <[email protected]> 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
>> [email protected]
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>> 
>> 
>> _______________________________________________
>> igraph-help mailing list
>> [email protected]
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>> 
>> 
>> 
>> _______________________________________________
>> igraph-help mailing list
>> [email protected] <mailto:[email protected]>
>> https://lists.nongnu.org/mailman/listinfo/igraph-help 
>> <https://lists.nongnu.org/mailman/listinfo/igraph-help>
>> 
> 
> _______________________________________________
> igraph-help mailing list
> [email protected] <mailto:[email protected]>
> https://lists.nongnu.org/mailman/listinfo/igraph-help 
> <https://lists.nongnu.org/mailman/listinfo/igraph-help>
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to