Skip to content

Commit

Permalink
pre-commit applied
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Aug 7, 2024
1 parent bbaf377 commit 4f777a8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions hypernetx/algorithms/hypergraph_modularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ def modularity(HG, A, wdc=linear):
_df = pd.DataFrame(zip(_keys, _vals), columns=["key", "val"])
_df = _df.groupby(by="key").sum()
EC = sum(
[wdc(k[1], k[0]) * v.iloc[0] for (k, v) in _df.iterrows() if k[0] > k[1] / 2]
[
wdc(k[1], k[0]) * v.iloc[0]
for (k, v) in _df.iterrows()
if k[0] > k[1] / 2
]
)

## Degree Tax
Expand Down Expand Up @@ -294,8 +298,8 @@ def two_section(HG):
G = ig.Graph.TupleList(s, weights=True).simplify(combine_edges="sum")

## add isolates if any
isolates = list(set([v for v in HG.nodes]) - set(G.vs['name']))
if len(isolates)>0:
isolates = list(set([v for v in HG.nodes]) - set(G.vs["name"]))
if len(isolates) > 0:
G.add_vertices(isolates)

return G
Expand Down

0 comments on commit 4f777a8

Please sign in to comment.