CWTSLeiden / networkanalysis

Java package that provides data structures and algorithms for network analysis.
MIT License
144 stars 33 forks source link

Effect of edge weights in resulting communities #18

Open paula-tataru opened 3 years ago

paula-tataru commented 3 years ago

Hi,

Thank you for developing this nice library! I have been trying to understand how weights affect the resulting detected communities and I found something which I did not expect.

Using the example graph you provided in the readme file, I created two versions containing weights on the edges - the edge weights in one version are scaled by a constant relative to the other version:

v1:

0   1   1
1   2   1
2   0   1
2   3   0.5
3   5   1
5   4   1
4   3   1

v2:

0   1   4
1   2   4
2   0   4
2   3   2
3   5   4
5   4   4
4   3   4

I ran the Leiden algorithm using the following options java -cp networkanalysis-1.1.0.jar nl.cwts.networkanalysis.run.RunNetworkClustering -r 0.2 -w

For v1, the same communities are detected as for the example in the readme file:

0   0
1   0
2   0
3   1
4   1
5   1

For v2, all nodes are part of one community:

0   0
1   0
2   0
3   0
4   0
5   0

I found this a bit surprising, as I didn't expect the scale of the weights to be so important and I expected to obtain the same results for these two networks.

I can see that in v1.1 of the library, two normalization methods have been introduced for the edge weights, but I couldn't find an explanation for why / when this might be needed and how the different normalization methods might impact the result.

Would it be possible to provide a brief explanation for this?

Thank you.

Best, Paula Tataru