-
Notifications
You must be signed in to change notification settings - Fork 39
community: new package implement Louvain graph modularisation #133
Conversation
4b7d90d
to
f487514
Compare
I'm a fair way into Louvain, so hold off on this and I'll submit as Q+Louvain (possibly others depending on how much additional work is needed for them). |
4b1ca7b
to
ff00885
Compare
1191bec
to
5a57447
Compare
For reference, the benchmark for the optimised code altered to use 1e4 or 1e5 node graphs gives the following results:
I think that is adequate. |
@vladimir-ch This is now ready for review. PTAL |
Two questions:
What do you think? The upshot of the non-type switched approach in conjunction with the two Q measures would be we have 4 Louvains and 4 Qs. |
// reduce returns a reduced graph constructed from g divided | ||
// into the given communities. The communities value is mutated | ||
// by the call to reduce. If communities is nil and g is a | ||
// ReducedGraph, it is returned unaltered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*ReducedGraph or leave it be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The English is nicer without sigils.
LGTM Re 1. If you think that the \gamma case is useful, then having two Qs seems like the only option (unless we add a bool argument but ...). QNull or LouvainNull do not sound like great names but I can't think of anything better. Re 2. Agreed on usefulness of modularity for directed graphs and on api duplication although I wish there were a third way. |
|
First pass - optimisations available.
name old time/op new time/op delta Louvain 7.18s ± 1% 0.12s ± 1% -98.26% (p=0.000 n=10+9)
name old time/op new time/op delta Louvain 119ms ± 1% 102ms ± 4% -14.31% (p=0.000 n=94+97) benchmark old allocs new allocs delta BenchmarkLouvain-8 509657 420228 -17.55% benchmark old bytes new bytes delta BenchmarkLouvain-8 26689475 20862968 -21.83%
Lyron has pointed out a section of Reichardt and Bornholdt that says this is possible, He's going to make an addition to louvain.tex showing its correctness. And I have an implementation of it ready - 140 lines of trivial Go. I just need to add some simple tests. |
This adds the measure used for modularity optimisation. The Louvain, LouvainMultilevel and SLM algorithms will come later.
I'm not sure about the API - the optimisation algorithms may demand a change, but what exists here looks OK for public use with the exception that community memberships must be disjoint and we don't check for that here.
https://en.wikipedia.org/wiki/Louvain_Modularity#Algorithm and http://arxiv.org/abs/cond-mat/0603718 for reference - the latter only for the resolution parameter.
@vladimir-ch Please take a look.