I am using the networkx library, more specifically the girvan_newman algorithm from nextworkx.algorithms.community.centrality on a data set of about 1200 vertices each with 1-10 edges between them. When I run the below code I only see two communities
ret = girvan_newman(G)
tuple(sorted(c) for c in next(ret))
I want to see it broken down further. I then tried
import itertools
limited=itertools.takewhile(lambda c: len(c) <= 20, ret)
for communities in limited:
print(tuple(sorted(c) for c in communities))
but the output is empty and I'm not sure what I'm doing wrong.
I also can't figure out how to access the lists of communities to put into a dataframe, not just print them.
Any help is appreciated!