-
Notifications
You must be signed in to change notification settings - Fork 13
Louvain algorithm #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
adding louvain fast unfolding
export the function
adding test and Require entry
I think your pr kind of went unnoticed, as there is not much activity on this package at the moment. I will try to have a look at your pr soon. |
No rush, I've been using community detection methods in my research and figured this is the best place to share the work. |
Hi @simonschoelly , do you by chance have any updates on this? |
I did some benchmarking and the algorithm is performing very well using BenchmarkTools
G = erdos_renyi(100, 0.1)
@benchmark community_detection_louvain(G)
@benchmark community_detection_bethe(G) Benchmark for Bethe
Benchmark for Louvain
I think it's time to do a pull request and make it to the codebase |
|
||
function louvain_make_pass(graph::AbstractGraph,communities::Vector{Int},tol::Float64) | ||
comm_list = copy(communities) | ||
current_modularity = modularity(graph,comm_list) |
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.
Is it possible to use a memoing function or to have the current_modularity
cached? I think this is the major bottleneck in performance. Did you profiled the code to inspect what are the major bottlenecks?
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.
Thanks for taking a look at the algorithm. I never did any profiling but it shouldn't be too bad to check the bottlenecks. I'll take a look at improving the benchmark. Maybe we can merge once we're happy with the performance?
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.
Try Memoize.jl
Closed in favor of #4 |
Here is a simple implementation of the Louvain fast-unfolding algorithm I whipped up. It has been giving valid communities for my problems.
The algorithm could use some speed-up enhancements. Notably, I'm using the LightGraphs.modularity function to calculate modularity change in my loop as opposed to calculating the change directly.
Please feel free to comment or make changes.