Skip to content

Commit

Permalink
Fix sparse diag by upgrading SciPy and Numpy (#650)
Browse files Browse the repository at this point in the history
* updated scipy requirement

* added test

* dropped python 3.9 support
  • Loading branch information
maximelucas authored Jan 27, 2025
1 parent b86da86 commit 29880f9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
strategy:
matrix:
os: [ubuntu, macos, windows]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4

Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "xgi"
dynamic = ["version"]
description = "XGI is a Python package for higher-order networks."
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.10"
license = {file = "LICENSE.md"}
authors = [
{name = "XGI Developers", email = "nicholas.landry@virginia.edu"}
Expand All @@ -30,7 +30,6 @@ classifiers = [
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -43,8 +42,8 @@ classifiers = [
"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
"numpy>=1.20",
"scipy>=1.8",
"numpy>=1.23.5",
"scipy>=1.15",
"pandas>=1.3",
"networkx>=2.7",
"requests>=2.0",
Expand Down
4 changes: 2 additions & 2 deletions requirements/default.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated via tools/generate_requirements.py and pre-commit hook.
# Do not edit this file; modify pyproject.toml instead.
numpy>=1.20
scipy>=1.8
numpy>=1.23.5
scipy>=1.15
pandas>=1.3
networkx>=2.7
requests>=2.0
Expand Down
17 changes: 17 additions & 0 deletions tests/linalg/test_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,23 @@ def test_adjacency_matrix(edgelist1, edgelist4):
assert np.all(A7 == A7_sp.todense())


def test_fix_649(): # make sure diagonal is fully zero when sparse

H = xgi.load_xgi_data(dataset="email-enron")
H.cleanup(isolates=True, singletons=False, connected=True, relabel=False, multiedges=False)

weighted = True
order = 1

adj = xgi.adjacency_matrix(H, order=order, sparse=False, weighted=weighted, index=False)

adj_sparse = xgi.adjacency_matrix(H, order=order, sparse=True, weighted=weighted, index=False)
adj_sparse = adj_sparse.todense()

assert np.all(np.diag(adj_sparse)==0)



def test_laplacian(edgelist2, edgelist6):
el1 = edgelist6
H1 = xgi.Hypergraph(el1)
Expand Down
2 changes: 2 additions & 0 deletions tools/generate_requirements.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python
"""Generate requirements/*.txt files from pyproject.toml.
Run from repo root folder.
Copied from NetworkX: https://github.com/networkx/networkx/blob/main/tools/generate_requirements.py
"""

Expand Down

0 comments on commit 29880f9

Please sign in to comment.