Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modularity function returns error: AttributeError: 'Entity' object has no attribute 'strength' #98

Closed
thosvarley opened this issue Sep 8, 2022 · 4 comments
Labels

Comments

@thosvarley
Copy link

thosvarley commented Sep 8, 2022

When I call print('qH =',hmod.modularity(H, K, strict)) it returns AttributeError: 'Entity' object has no attribute 'strength'

The full code:

import igraph as ig
import hypernetx as hnx
import hypernetx.algorithms.hypergraph_modularity as hmod

H = hnx.Hypergraph(lookup)
H = hmod.precompute_attributes(H)
#%%
K = hmod.kumar(H)
#%%
strict = hmod.strict
## Compute qH
print('qH =',hmod.modularity(H, K, strict))

Lookup is a dictionary of the form: {key1 : (hedge1, hedge2...), key2 : (hedge1, hedge3...)}

@madelynshapiro
Copy link
Contributor

Thank you for raising an issue, I will look into it. It looks like a line of code from your original post has been updated from hmod.precompute_attributes(H) -> H = hmod.precompute_attributes(H) - just to clarify, you are still receiving the same error message with the updated code?

@thosvarley
Copy link
Author

EDIT: I realize that I was feeding the Hgraph in wrong. I was doing:

{node : (hedge1, hedge2...)} when I should have been doing {hedge1 : (node1, node2...)}. Fixing this solved the issue.

@thosvarley thosvarley reopened this Sep 9, 2022
@thosvarley
Copy link
Author

Reopening the issue since the change described above just changes the error from being about strength to being about weight.

bonicim added a commit that referenced this issue Jun 29, 2023
Merge in HYP/hypernetx from releases/v2.0.2 to master

* commit 'dd76f358ef5d6f2b76c24260bb7edb6ad4ac98c0':
  bump: version 2.0.1 → 2.0.2
  Fix import try catch block; update pypi workflow
@brendapraggastis
Copy link
Collaborator

Resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants