Speed and accuracy of Louvain method in Gephi

Computing metrics, community detection and data handling
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
xptrxptr
Posts:31
Joined:21 Dec 2010 21:17
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
Speed and accuracy of Louvain method in Gephi

Post by xptrxptr » 02 Aug 2012 10:20

Hi all.

I have a simple question about community detection in Gephi.

Are there any more details available which version of Louvain method
is actually implemented in Gephi?
I compared results obtained by Gephi and Pajek and found out two facts:
a) results obtained by Pajek have significantly higher modularities
(especially for some values of resolution parameter)
b) results in Pajek are obtained much faster

In Pajek documentation it says that they implemented
"Multilevel Coarsening and Multilevel Refinement algorithm"

I guess your algorithm is only original Louvain method with only coarsening
and without multilevel refinement?
But what surprizes me, that in this case I would expect that your implementation
should be faster (since it is simpler) but it is actually slower
(especially for larger networks).

Any response would be highy appreciated, since I need
to explain the algorithm used as well.

Petra

taynaud
Gephi Plugin Developer
Posts:10
Joined:23 Dec 2010 02:19
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Speed and accuracy of Louvain method in Gephi

Post by taynaud » 03 Aug 2012 09:03

Concerning speed:
I do not know how Louvain is implemented in Pajek.

In Gephi, it is not as efficient as it could since the whole graph is copied and the algorithm works on its own copy of the graph.

Another optimisation is to stop the algorithm when the modularity does not raise of more than epsilon and I think it is not implemented.

A possibility is also the language and how the graph is stored. For instance, the python version of louvain is 10 times slower than the C implementation, mostly because of the graph storage and python.

Finaly, Louvain is not totally deterministic and you may be in a case where it is slow. Randomness may help here. Do you use weights (some very small ?) ?


Finally, concerning modularity:

I think that the modularity reported is always the Newman's modularity of the partition found, thus it depends only on the partition and not the resolution parameter. Thus, optimisation is done with the resolution parameter, but not the numeric value reported. Thus, you are not comparing exactly the same things.


I do not know what Pajek call coarsening and multi level refinment. Gephi implements only Louvain Method and not small optimisations of modularity achievable (for instance, optimising again modularity after last partition) as described in Blondel et al. paper. You should be carefull with "modularity over optimisation". Modularity is a very interesting metrics, but you should not stick too much to small modularity gain that are not always meaningfull.

Thomas

pegerp
Posts:124
Joined:21 Dec 2011 17:10
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Speed and accuracy of Louvain method in Gephi

Post by pegerp » 03 Aug 2012 12:06

taynaud wrote:Modularity is a very interesting metrics, but you should not stick too much to small modularity gain that are not always meaningfull.
Hi. I've noticed earlier that small differences in modularity in Gephi can produce aesthetically different results when used with Force Atlas 2 layout algorithm. See https://forum.gephi.org/viewtopic.php?f=32&t=1585 (compare: http://i.imgur.com/zI3q1.png vs. http://i.imgur.com/JAhOp.png). Taynaud explained the modularity well.

In my network it was feasible to run the modularity algorithm several times and pick the most pleasing module coloring result. In the process I noticed that the higher the reported modularity value is the more pleasing the coloring on Force Atlas 2 layout is.

xptrxptr
Posts:31
Joined:21 Dec 2010 21:17
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Speed and accuracy of Louvain method in Gephi

Post by xptrxptr » 03 Aug 2012 12:13

...I do not know what Pajek call coarsening and multi level refinment....

Explained here:
http://dl.acm.org/citation.cfm?id=1970376

...Modularity is a very interesting metrics, but you should not stick too much to small modularity gain that are not always meaningfull...

That is true for small graphs, e.g. 1.000-10.000 nodes, but when dealing with graphs with millions of nodes
already improvement for 0.001 can produce much better communities.

xptrxptr
Posts:31
Joined:21 Dec 2010 21:17
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Speed and accuracy of Louvain method in Gephi

Post by xptrxptr » 09 Aug 2012 19:19

I just tried the latest version of Pajek and found there another very useful community detection algorithm.
It is called VOS. For many graphs the communites found by this method are better
than the one obtained by Louvain.
Since we know that all modularity based clusterings have problems my question is:
do you plan to include some other communiy detection method in the near future?
Thanks.
XPeTRa

admin
Gephi Community Manager
Posts:964
Joined:09 Dec 2009 14:41
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Speed and accuracy of Louvain method in Gephi

Post by admin » 10 Aug 2012 09:18

No, but the community can implement other algorithms, which will also have their own problems too.

xptrxptr
Posts:31
Joined:21 Dec 2010 21:17
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Speed and accuracy of Louvain method in Gephi

Post by xptrxptr » 13 Aug 2012 07:42

Thanks for reply.
I found the following page very interesting:
comparison of Louvain method and VOS Clustering:
http://mrvar.fdv.uni-lj.si/pajek/commun ... ainVOS.htm
I tried it with graphs with some tens of millions of nodes
and it works really well.
Petra

User avatar
albertocottica
Posts:12
Joined:24 Jun 2012 13:46
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Speed and accuracy of Louvain method in Gephi

Post by albertocottica » 17 Aug 2012 12:28

Hello all,

can I ask what it means that Louvain is not totally deterministic? On a small network (200 nodes, 1500 edges, weighted with weights being integers) I get different values every time I run the algorithm. Also the number of subcommunities changes, which is a bit unsettling.

xptrxptr
Posts:31
Joined:21 Dec 2010 21:17
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Speed and accuracy of Louvain method in Gephi

Post by xptrxptr » 19 Aug 2012 07:21

Multilevel coarsening and refinement algorithm (which is implemented in Pajek) is much more stable than standard Louvain method.
For network like yours, I need approx. 3 restarts to get the stable final result.

On
http://mrvar.fdv.uni-lj.si/pajek/commun ... xample.htm
there is a useful hint about results obtained by community detections:
Compare the partitions obtained in two runs with the same resolution parameter (using Partitions/Info/Cramer's V, Rajski, Adjusted Rand Index). If the correlation of the two partitions is small, the number of communities is probably not the right one, therefore we suggest to try the algorithm with another (larger or smaller) value of resolution parameter.

I hope that will be of some help to you.

Petra

User avatar
albertocottica
Posts:12
Joined:24 Jun 2012 13:46
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Speed and accuracy of Louvain method in Gephi

Post by albertocottica » 03 Nov 2012 10:55

Thanks, Petra, I had managed to miss your reply! :-)

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable