diff --git a/tests/stats/test_edgestats.py b/tests/stats/test_edgestats.py index 2f019dec4..0c85dfd4a 100644 --- a/tests/stats/test_edgestats.py +++ b/tests/stats/test_edgestats.py @@ -51,6 +51,7 @@ def test_aggregates(edgelist1, edgelist2, edgelist8): H = xgi.Hypergraph(edgelist1) assert H.edges.order.max() == 2 assert H.edges.order.min() == 0 + assert H.edges.order.sum() == 5 assert round(H.edges.order.mean(), 3) == 1.25 assert round(H.edges.order.std(), 3) == 0.829 assert round(H.edges.order.var(), 3) == 0.688 @@ -58,6 +59,7 @@ def test_aggregates(edgelist1, edgelist2, edgelist8): H = xgi.Hypergraph(edgelist2) assert H.edges.order.max() == 2 assert H.edges.order.min() == 1 + assert H.edges.order.sum() == 4 assert round(H.edges.order.mean(), 3) == 1.333 assert round(H.edges.order.std(), 3) == 0.471 assert round(H.edges.order.var(), 3) == 0.222 @@ -65,6 +67,7 @@ def test_aggregates(edgelist1, edgelist2, edgelist8): H = xgi.Hypergraph(edgelist8) assert H.edges.order.max() == 4 assert H.edges.order.min() == 1 + assert H.edges.order.sum() == 17 assert round(H.edges.order.mean(), 3) == 1.889 assert round(H.edges.order.std(), 3) == 0.875 assert round(H.edges.order.var(), 3) == 0.765 diff --git a/tests/stats/test_nodestats.py b/tests/stats/test_nodestats.py index b954cb16c..eedf50faa 100644 --- a/tests/stats/test_nodestats.py +++ b/tests/stats/test_nodestats.py @@ -160,6 +160,7 @@ def test_aggregates(edgelist1, edgelist2, edgelist8): H = xgi.Hypergraph(edgelist1) assert H.nodes.degree.max() == 2 assert H.nodes.degree.min() == 1 + assert H.nodes.degree.sum() == 9 assert round(H.nodes.degree.mean(), 3) == 1.125 assert round(H.nodes.degree.std(), 3) == 0.331 assert round(H.nodes.degree.var(), 3) == 0.109 @@ -167,6 +168,7 @@ def test_aggregates(edgelist1, edgelist2, edgelist8): H = xgi.Hypergraph(edgelist2) assert H.nodes.degree.max() == 2 assert H.nodes.degree.min() == 1 + assert H.nodes.degree.sum() == 7 assert round(H.nodes.degree.mean(), 3) == 1.167 assert round(H.nodes.degree.std(), 3) == 0.373 assert round(H.nodes.degree.var(), 3) == 0.139 @@ -174,6 +176,7 @@ def test_aggregates(edgelist1, edgelist2, edgelist8): H = xgi.Hypergraph(edgelist8) assert H.nodes.degree.max() == 6 assert H.nodes.degree.min() == 2 + assert H.nodes.degree.sum() == 26 assert round(H.nodes.degree.mean(), 3) == 3.714 assert round(H.nodes.degree.std(), 3) == 1.385 assert round(H.nodes.degree.var(), 3) == 1.918 diff --git a/xgi/readwrite/xgi_data.py b/xgi/readwrite/xgi_data.py index fff88f39b..7edae7967 100644 --- a/xgi/readwrite/xgi_data.py +++ b/xgi/readwrite/xgi_data.py @@ -34,7 +34,7 @@ def load_xgi_data(dataset, nodetype=None, edgetype=None): index = requests.get(index_url).json() if dataset not in index: print("Valid dataset names:") - print(*index, sep = "\n") + print(*index, sep="\n") raise XGIError("Must choose a valid dataset name!") r = requests.get(index[dataset]["url"]) diff --git a/xgi/stats/__init__.py b/xgi/stats/__init__.py index 725410925..4210dc4d7 100644 --- a/xgi/stats/__init__.py +++ b/xgi/stats/__init__.py @@ -231,6 +231,10 @@ def min(self): """The minimum value of this stat.""" return self.asnumpy().min(axis=0) + def sum(self): + """The sum of this stat.""" + return self.asnumpy().sum(axis=0) + def mean(self): """The arithmetic mean of this stat.""" return self.asnumpy().mean(axis=0)