Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Gilles Peiffer <[email protected]>
  • Loading branch information
rossbar and Peiffap committed Oct 17, 2024
1 parent 1a7a7d2 commit 7c13573
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions networkx/algorithms/structuralholes.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def redundancy(G, u, v, weight=None):
for v in nodes:
# Effective size is not defined for isolated nodes, including nodes
# with only self-edges
if (len(G[v]) == 0) or (set(G[v]) == {v}):
if all(u == v for u in G[v]):
effective_size[v] = float("nan")
continue
E = nx.ego_graph(G, v, center=False, undirected=True)
Expand All @@ -163,7 +163,7 @@ def redundancy(G, u, v, weight=None):
for v in nodes:
# Effective size is not defined for isolated nodes, including nodes
# with only self-edges
if (len(G[v]) == 0) or (set(G[v]) == {v}):
if all(u == v for u in G[v]):
effective_size[v] = float("nan")
continue
effective_size[v] = sum(
Expand Down

0 comments on commit 7c13573

Please sign in to comment.