structify_net.scoring.modularity

structify_net.scoring.modularity(graph, normalized=True)

Returns the modularity of the graph

If normalized=True, it is computed as the difference between the modularity of the partition of highest modularity found by Louvain algorithm on this graph and the modularity of a random graph with the same number of nodes and edges, divided by the difference between the modularity of the random graph and the maximum possible modularity (1). If normalized is false, it simply returns the modularity of the graph.

Args:

graph (_type_): a graph normalized (bool, optional): if True, returns a normalized modularity. Defaults to True.

Returns:

_type_: The modularity of the graph