diff options
author | Mridul Seth <seth.mridul@gmail.com> | 2023-04-17 01:32:09 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-16 13:02:09 -0700 |
commit | 5aad3ddbf977bfbb1a11fde01af351c57dcecdc5 (patch) | |
tree | bd4b5628ea97f0cf88b87a88e7f91476461e6a2d | |
parent | f1123d234c9e8b889afd81e7c2d36f7a3f464c6d (diff) | |
download | networkx-5aad3ddbf977bfbb1a11fde01af351c57dcecdc5.tar.gz |
Use the correct namespace for girvan_newman examples (#6643)
-rw-r--r-- | networkx/algorithms/community/centrality.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/networkx/algorithms/community/centrality.py b/networkx/algorithms/community/centrality.py index 926cd9a8..9dc15386 100644 --- a/networkx/algorithms/community/centrality.py +++ b/networkx/algorithms/community/centrality.py @@ -32,7 +32,7 @@ def girvan_newman(G, most_valuable_edge=None): To get the first pair of communities:: >>> G = nx.path_graph(10) - >>> comp = girvan_newman(G) + >>> comp = nx.community.girvan_newman(G) >>> tuple(sorted(c) for c in next(comp)) ([0, 1, 2, 3, 4], [5, 6, 7, 8, 9]) @@ -42,7 +42,7 @@ def girvan_newman(G, most_valuable_edge=None): >>> import itertools >>> G = nx.path_graph(8) >>> k = 2 - >>> comp = girvan_newman(G) + >>> comp = nx.community.girvan_newman(G) >>> for communities in itertools.islice(comp, k): ... print(tuple(sorted(c) for c in communities)) ... @@ -55,7 +55,7 @@ def girvan_newman(G, most_valuable_edge=None): >>> import itertools >>> G = nx.path_graph(8) >>> k = 4 - >>> comp = girvan_newman(G) + >>> comp = nx.community.girvan_newman(G) >>> limited = itertools.takewhile(lambda c: len(c) <= k, comp) >>> for communities in limited: ... print(tuple(sorted(c) for c in communities)) @@ -74,7 +74,7 @@ def girvan_newman(G, most_valuable_edge=None): ... u, v, w = max(G.edges(data="weight"), key=itemgetter(2)) ... return (u, v) ... - >>> comp = girvan_newman(G, most_valuable_edge=heaviest) + >>> comp = nx.community.girvan_newman(G, most_valuable_edge=heaviest) >>> tuple(sorted(c) for c in next(comp)) ([0, 1, 2, 3, 4, 5, 6, 7, 8], [9]) @@ -87,7 +87,7 @@ def girvan_newman(G, most_valuable_edge=None): ... return max(centrality, key=centrality.get) ... >>> G = nx.path_graph(10) - >>> comp = girvan_newman(G, most_valuable_edge=most_central_edge) + >>> comp = nx.community.girvan_newman(G, most_valuable_edge=most_central_edge) >>> tuple(sorted(c) for c in next(comp)) ([0, 1, 2, 3, 4], [5, 6, 7, 8, 9]) @@ -107,7 +107,7 @@ def girvan_newman(G, most_valuable_edge=None): ... return max(centrality, key=centrality.get) ... >>> G = nx.path_graph(10) - >>> comp = girvan_newman(G, most_valuable_edge=most_central_edge) + >>> comp = nx.community.girvan_newman(G, most_valuable_edge=most_central_edge) Notes ----- |