I'm using the following function in order to get a modularity score for a given graph:
import networkx as nx
def modularity_score(graph):
return nx_comm.modularity(graph, nx_comm.label_propagation_communities(graph))
Let's say my graph has 1858 nodes and it returns 0.7278 as my score.
Now I've learned that null models can help identify network properties that are different from what is expected based on the null hypothesis that networks are mostly random.
So which Networkx method can I use to compare my observed modularity score against and how do I calculate the test significance?
Using random graph with the same number of nodes?