I have used Louvain algorithm for community detection. Then position the communities with respect to each other: create a new, weighted graph, where each node corresponds to a community, and the weights correspond to the number of edges between communities.
My problem is how to efficiently calculate "the number of edges between communities". I know I can do I massive for loop for every single two nodes from each community.
Is there a function in Networkx that implements this?