Compute the modularity and number communities of graph g, w.r.t. its community structure, obtained through the chosen clustering method.

compute_modularity(g, method = igraph::cluster_louvain, ...)

Arguments

g

a graph. If the graph is not connected, the largest connected component is selected.

method

default is cluster_louvain, but others are possible: e.g. cluster_fast_greedy, cluster_infomap.

...

additional parameters passed to the chosen igraph clustering method. The default cluster_louvain has a weights parameter, ehich can be a positive weight vector, or the E(g)$weight attribute, or NA if the graph has a 'weight' edge attribute, but you want to ignore it. Larger edge weights correspond to stronger connections. Check out parameters for others methods.

Value

list(Q, N) where:

  • Qthe modularity

  • Nthe number of communities

References

Newman

See also

[igraph::cluster_infomap()]