Measuring the modularity
using EcologicalNetwork # Get the data in an object N = mcmullen();
The next step is to generate starting communities for every species. We will assign species to random initial modules:
L = rand(1:richness(N), richness(N));
We can now start a repeated number of attempts to find the best partition, here using
julia is started in parallel, this will use all assigned CPUs.
M = modularity(N, L, brim, replicates=100); # Finally, we can get the best partition b_part = best_partition(M); # And print its modularity and number of modules println("Q: ", round(b_part.Q, 2), " |c|: ", length(unique(b_part.L)) )
Q: 0.52 |c|: 28