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

Add assortativity module #122

Merged
merged 19 commits into from
Jun 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: fixed the uniform assortativity function.
  • Loading branch information
nwlandry committed Jun 5, 2022
commit 480bbbf9575e8d072329e4e5ab1e9ecabd7112c4
4 changes: 2 additions & 2 deletions xgi/algorithms/assortativity.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def uniform_assortativity(H):
degrees = dict(H.degree())
try:
k1k2 = [[degrees[n] for n in random.sample(H.edges.members(e), 2)] for e in H.edges]
except IndexError:
except ValueError:
raise XGIError("Hypergraph must not have singleton edges.")

return np.corrcoef(*k1k2)[0, 1]
return np.corrcoef(list(zip(*k1k2)))[0, 1]