From e87a3e03eaf6de39d9cc0533b334a7c2db9d9216 Mon Sep 17 00:00:00 2001 From: "ryan.danehy@pnnl.gov" Date: Wed, 7 Aug 2024 10:40:45 -0700 Subject: [PATCH 1/7] pre-commit and version tag --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index a81215b6..676be96f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,8 @@ scikit-learn = ">=1.4.2" celluloid = ">=0.2.0" igraph = ">=0.11.4" decorator = ">=5.1.1" +scipy = "1.13.1" +numpy = "1.26.4" [tool.poetry.group.widget] optional = true From 6b28c0e4339b74c62c7362f648df3c29983fe9d8 Mon Sep 17 00:00:00 2001 From: "ryan.danehy@pnnl.gov" Date: Wed, 7 Aug 2024 10:41:38 -0700 Subject: [PATCH 2/7] pre-commit and version tag --- hypernetx/algorithms/hypergraph_modularity.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hypernetx/algorithms/hypergraph_modularity.py b/hypernetx/algorithms/hypergraph_modularity.py index f29efe3b..a132ed43 100644 --- a/hypernetx/algorithms/hypergraph_modularity.py +++ b/hypernetx/algorithms/hypergraph_modularity.py @@ -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 @@ -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 From 654b3c68e359a975d12f91e50e71a8e2348beb91 Mon Sep 17 00:00:00 2001 From: Brenda Praggastis Date: Wed, 7 Aug 2024 13:29:33 -0700 Subject: [PATCH 3/7] updated test suite to use .toarray instead of .A to transform csr_matrix to numpy array --- tests/classes/test_hypergraph.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/classes/test_hypergraph.py b/tests/classes/test_hypergraph.py index 341c2e5e..d298f1ee 100644 --- a/tests/classes/test_hypergraph.py +++ b/tests/classes/test_hypergraph.py @@ -1093,7 +1093,7 @@ def test_incidence_matrix(sevenbysix): len(sevenbysix.nodes), len(sevenbysix.edges), ) - assert np.allclose(incidence_matrix.A, sevenbysix.incidence_matrix.A) + assert np.allclose(incidence_matrix.toarray, sevenbysix.incidence_matrix.toarray) # check the edge and node indexes assert nodes_idx.tolist() == list(sevenbysix.nodes) @@ -1109,7 +1109,7 @@ def test_adjacency_matrix(sevenbysix): len(sevenbysix.nodes), len(sevenbysix.nodes), ) - assert np.allclose(adjacency_matrix.A, sevenbysix.s1_adjacency_matrx.A) + assert np.allclose(adjacency_matrix.toarray, sevenbysix.s1_adjacency_matrx.A) assert node_idx.tolist() == list(sevenbysix.nodes) @@ -1122,7 +1122,7 @@ def test_edge_adjacency_matrix(sevenbysix): len(sevenbysix.edges), len(sevenbysix.edges), ) - assert np.allclose(adjacency_matrix.A, sevenbysix.s1_edge_adjacency_matrx.A) + assert np.allclose(adjacency_matrix.toarray, sevenbysix.s1_edge_adjacency_matrx.A) assert node_idx.tolist() == list(sevenbysix.edges) @@ -1132,7 +1132,7 @@ def test_auxiliary_matrix_on_nodes(sevenbysix): aux_matrix, indexes = hg.auxiliary_matrix(index=True) assert aux_matrix.todense().shape == (len(sevenbysix.nodes), len(sevenbysix.nodes)) - assert np.allclose(aux_matrix.A, sevenbysix.s1_adjacency_matrx.A) + assert np.allclose(aux_matrix.toarray, sevenbysix.s1_adjacency_matrix.toarray) assert indexes.tolist() == list(sevenbysix.nodes) @@ -1142,7 +1142,7 @@ def test_auxiliary_matrix_on_edges(sevenbysix): aux_matrix, indexes = hg.auxiliary_matrix(node=False, index=True) assert aux_matrix.todense().shape == (len(sevenbysix.edges), len(sevenbysix.edges)) - assert np.allclose(aux_matrix.A, sevenbysix.s1_edge_adjacency_matrx.A) + assert np.allclose(aux_matrix.toarray, sevenbysix.s1_edge_adjacency_matrx.A) assert indexes.tolist() == list(sevenbysix.edges) From d990862ccd15b0a3b84fca5a38e22959db57f727 Mon Sep 17 00:00:00 2001 From: Brenda Praggastis Date: Wed, 7 Aug 2024 13:43:43 -0700 Subject: [PATCH 4/7] fixed some typos and updated the version of scipy --- pyproject.toml | 2 +- tests/classes/conftest.py | 4 ++-- tests/classes/test_hypergraph.py | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 676be96f..52bad784 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ scikit-learn = ">=1.4.2" celluloid = ">=0.2.0" igraph = ">=0.11.4" decorator = ">=5.1.1" -scipy = "1.13.1" +scipy = ">=1.13" numpy = "1.26.4" [tool.poetry.group.widget] diff --git a/tests/classes/conftest.py b/tests/classes/conftest.py index 52712d8f..4d2aec86 100644 --- a/tests/classes/conftest.py +++ b/tests/classes/conftest.py @@ -86,7 +86,7 @@ def __init__(self): [0, 0, 0, 0, 0, 1], ] ) - self.s1_adjacency_matrx = scipy.sparse.csr_matrix( + self.s1_adjacency_matrix = scipy.sparse.csr_matrix( [ [0, 1, 1, 1, 0, 1, 1], [1, 0, 1, 1, 0, 0, 0], @@ -97,7 +97,7 @@ def __init__(self): [1, 0, 0, 1, 0, 1, 0], ] ) - self.s1_edge_adjacency_matrx = scipy.sparse.csr_matrix( + self.s1_edge_adjacency_matrix = scipy.sparse.csr_matrix( [ [0, 0, 1, 1, 0, 1], [0, 0, 0, 1, 1, 0], diff --git a/tests/classes/test_hypergraph.py b/tests/classes/test_hypergraph.py index d298f1ee..d473286d 100644 --- a/tests/classes/test_hypergraph.py +++ b/tests/classes/test_hypergraph.py @@ -1093,7 +1093,7 @@ def test_incidence_matrix(sevenbysix): len(sevenbysix.nodes), len(sevenbysix.edges), ) - assert np.allclose(incidence_matrix.toarray, sevenbysix.incidence_matrix.toarray) + assert np.allclose(incidence_matrix.toarray(), sevenbysix.incidence_matrix.toarray()) # check the edge and node indexes assert nodes_idx.tolist() == list(sevenbysix.nodes) @@ -1109,7 +1109,7 @@ def test_adjacency_matrix(sevenbysix): len(sevenbysix.nodes), len(sevenbysix.nodes), ) - assert np.allclose(adjacency_matrix.toarray, sevenbysix.s1_adjacency_matrx.A) + assert np.allclose(adjacency_matrix.toarray(), sevenbysix.s1_adjacency_matrix.toarray()) assert node_idx.tolist() == list(sevenbysix.nodes) @@ -1122,7 +1122,7 @@ def test_edge_adjacency_matrix(sevenbysix): len(sevenbysix.edges), len(sevenbysix.edges), ) - assert np.allclose(adjacency_matrix.toarray, sevenbysix.s1_edge_adjacency_matrx.A) + assert np.allclose(adjacency_matrix.toarray(), sevenbysix.s1_edge_adjacency_matrix.toarray()) assert node_idx.tolist() == list(sevenbysix.edges) @@ -1132,7 +1132,7 @@ def test_auxiliary_matrix_on_nodes(sevenbysix): aux_matrix, indexes = hg.auxiliary_matrix(index=True) assert aux_matrix.todense().shape == (len(sevenbysix.nodes), len(sevenbysix.nodes)) - assert np.allclose(aux_matrix.toarray, sevenbysix.s1_adjacency_matrix.toarray) + assert np.allclose(aux_matrix.toarray(), sevenbysix.s1_adjacency_matrix.toarray()) assert indexes.tolist() == list(sevenbysix.nodes) @@ -1142,7 +1142,7 @@ def test_auxiliary_matrix_on_edges(sevenbysix): aux_matrix, indexes = hg.auxiliary_matrix(node=False, index=True) assert aux_matrix.todense().shape == (len(sevenbysix.edges), len(sevenbysix.edges)) - assert np.allclose(aux_matrix.toarray, sevenbysix.s1_edge_adjacency_matrx.A) + assert np.allclose(aux_matrix.toarray(), sevenbysix.s1_edge_adjacency_matrix.toarray()) assert indexes.tolist() == list(sevenbysix.edges) From f830b4970b5720cf7820164f53bf4e347f37a608 Mon Sep 17 00:00:00 2001 From: "ryan.danehy@pnnl.gov" Date: Wed, 14 Aug 2024 11:15:58 -0700 Subject: [PATCH 5/7] remove numpy required version --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 52bad784..f0ef280f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,6 @@ celluloid = ">=0.2.0" igraph = ">=0.11.4" decorator = ">=5.1.1" scipy = ">=1.13" -numpy = "1.26.4" [tool.poetry.group.widget] optional = true From 137d970bd2bc2fb9fd9b086c1c8412319beb3153 Mon Sep 17 00:00:00 2001 From: "ryan.danehy@pnnl.gov" Date: Wed, 14 Aug 2024 14:15:29 -0700 Subject: [PATCH 6/7] pre-commit edits --- tests/classes/test_hypergraph.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/classes/test_hypergraph.py b/tests/classes/test_hypergraph.py index d473286d..708bb968 100644 --- a/tests/classes/test_hypergraph.py +++ b/tests/classes/test_hypergraph.py @@ -1093,7 +1093,9 @@ def test_incidence_matrix(sevenbysix): len(sevenbysix.nodes), len(sevenbysix.edges), ) - assert np.allclose(incidence_matrix.toarray(), sevenbysix.incidence_matrix.toarray()) + assert np.allclose( + incidence_matrix.toarray(), sevenbysix.incidence_matrix.toarray() + ) # check the edge and node indexes assert nodes_idx.tolist() == list(sevenbysix.nodes) @@ -1109,7 +1111,9 @@ def test_adjacency_matrix(sevenbysix): len(sevenbysix.nodes), len(sevenbysix.nodes), ) - assert np.allclose(adjacency_matrix.toarray(), sevenbysix.s1_adjacency_matrix.toarray()) + assert np.allclose( + adjacency_matrix.toarray(), sevenbysix.s1_adjacency_matrix.toarray() + ) assert node_idx.tolist() == list(sevenbysix.nodes) @@ -1122,7 +1126,9 @@ def test_edge_adjacency_matrix(sevenbysix): len(sevenbysix.edges), len(sevenbysix.edges), ) - assert np.allclose(adjacency_matrix.toarray(), sevenbysix.s1_edge_adjacency_matrix.toarray()) + assert np.allclose( + adjacency_matrix.toarray(), sevenbysix.s1_edge_adjacency_matrix.toarray() + ) assert node_idx.tolist() == list(sevenbysix.edges) @@ -1142,7 +1148,9 @@ def test_auxiliary_matrix_on_edges(sevenbysix): aux_matrix, indexes = hg.auxiliary_matrix(node=False, index=True) assert aux_matrix.todense().shape == (len(sevenbysix.edges), len(sevenbysix.edges)) - assert np.allclose(aux_matrix.toarray(), sevenbysix.s1_edge_adjacency_matrix.toarray()) + assert np.allclose( + aux_matrix.toarray(), sevenbysix.s1_edge_adjacency_matrix.toarray() + ) assert indexes.tolist() == list(sevenbysix.edges) From 10bd14e70d99f96dd3c841289f909769c25d6c62 Mon Sep 17 00:00:00 2001 From: "ryan.danehy@pnnl.gov" Date: Wed, 14 Aug 2024 14:16:21 -0700 Subject: [PATCH 7/7] =?UTF-8?q?bump:=20version=202.3.5=20=E2=86=92=202.3.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cz.toml | 2 +- docs/source/conf.py | 2 +- hypernetx/__init__.py | 2 +- pyproject.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.cz.toml b/.cz.toml index a1215f5c..c31d7848 100644 --- a/.cz.toml +++ b/.cz.toml @@ -1,6 +1,6 @@ [tool.commitizen] name = "cz_conventional_commits" -version = "2.3.5" +version = "2.3.6" version_provider = "poetry" version_files = [ "pyproject.toml", diff --git a/docs/source/conf.py b/docs/source/conf.py index fc65e2c6..bb2695a5 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -19,7 +19,7 @@ import os -__version__ = "2.3.5" +__version__ = "2.3.6" # If extensions (or modules to document with autodoc) are in another directory, diff --git a/hypernetx/__init__.py b/hypernetx/__init__.py index 6a19503d..f0b7699a 100644 --- a/hypernetx/__init__.py +++ b/hypernetx/__init__.py @@ -11,4 +11,4 @@ from hypernetx.utils import * from hypernetx.utils.toys import * -__version__ = "2.3.5" +__version__ = "2.3.6" diff --git a/pyproject.toml b/pyproject.toml index f0ef280f..4a24be40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "hypernetx" -version = "2.3.5" +version = "2.3.6" description = "HyperNetX is a Python library for the creation and study of hypergraphs." authors = ["Brenda Praggastis ", "Dustin Arendt ", "Sinan Aksoy ", "Emilie Purvine ",