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

Simplify dihypergraph #541

Merged
merged 20 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions HOW_TO_CONTRIBUTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Please note we have a [code of conduct](/CODE_OF_CONDUCT.md), please follow it i
## Pull Request process

1. Download the dependencies in the developer [requirements file](/requirements/developer.txt).
2. [Optional, but STRONGLY preferred] Add unit tests for features being added or bugs being fixed.
3. [Optional, but STRONGLY preferred] Include any new method/function in the corresponding docs file.
2. Add unit tests for features being added or bugs being fixed.
3. Include any new method/function in the corresponding docs file.
4. Run `pytest` to verify all unit tests pass.
5. Identify the unnecessary imports in the
1. source code by running `pylint xgi/ --disable all --enable W0611`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ This library may not meet your needs and if this is this case, consider checking
* [halp](http://murali-group.github.io/halp): A Python package with directed and undirected hypergraph implementations and several algorithms.
* [Hypergraph Analysis Toolbox (HAT)](https://hypergraph-analysis-toolbox.readthedocs.io): A Python/Matlab package for hypergraph construction, visualization, and analysis (Especially for Pore-C data).
* [Hypergraphx](https://hypergraphx.readthedocs.io): A Python for representing, analyzing, and visualizing hypergraphs.
* [HyperNetX](https://hypernetx.readthedocs.io/en/latest/): A Python package for representing, analyzing, and visualizing hypergraphs.
* [HyperNetX](https://hypernetx.readthedocs.io): A Python package for representing, analyzing, and visualizing hypergraphs.
* [NetworkX](https://networkx.org): A Python package for representing, analyzing, and visualizing networks.
* [Reticula](https://docs.reticula.network): A Python package wrapping C++ functions for representing, analyzing, and visualizing temporal and static graphs and hypergraphs.

Expand Down
1 change: 0 additions & 1 deletion docs/source/api/core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ core functionality
~xgi.core.dihypergraph
~xgi.core.simplicialcomplex
~xgi.core.views
~xgi.core.diviews
~xgi.core.globalviews
18 changes: 0 additions & 18 deletions docs/source/api/core/xgi.core.diviews.DiIDView.rst

This file was deleted.

16 changes: 0 additions & 16 deletions docs/source/api/core/xgi.core.diviews.rst

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
xgi.core.diviews.DiEdgeView
===========================
xgi.core.views.DiEdgeView
=========================

.. currentmodule:: xgi.core.diviews
.. currentmodule:: xgi.core.views

.. autoclass:: DiEdgeView
:show-inheritance:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
xgi.core.diviews.DiNodeView
===========================
xgi.core.views.DiNodeView
=========================

.. currentmodule:: xgi.core.diviews
.. currentmodule:: xgi.core.views

.. autoclass:: DiNodeView
:show-inheritance:
Expand Down
4 changes: 3 additions & 1 deletion docs/source/api/core/xgi.core.views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@

IDView
NodeView
EdgeView
EdgeView
DiNodeView
DiEdgeView
14 changes: 10 additions & 4 deletions docs/source/using-xgi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Published work
2024
----

Nicholas W. Landry, Ilya Amburg, Mirah Shi, and Sinan Aksoy, "Filtering higher-order datasets", *Journal of Physics: Complexity* **5** 015006 (2024).
Nicholas W. Landry, Ilya Amburg, Mirah Shi, and Sinan Aksoy, "Filtering higher-order datasets", *Journal of Physics: Complexity* **5**, 015006 (2024).

:bdg-link-primary-line:`Paper <https://doi.org/10.1088/2632-072X/ad253a>`
:bdg-link-primary-line:`Code <https://github.com/nwlandry/filtering-higher-order-datasets>`
Expand All @@ -22,7 +22,7 @@ Nicholas W. Landry, Jean-Gabriel Young, and Nicole Eikmeier, "The simpliciality
:bdg-link-primary-line:`Paper <https://doi.org/10.1140/epjds/s13688-024-00458-1>`
:bdg-link-primary-line:`Code <https://github.com/nwlandry/the-simpliciality-of-higher-order-networks>`

Leonie Neuhäuser, Michael Scholkemper, Francesco Tudisco, and Michael T. Schaub, "Learning the effective order of a hypergraph dynamical system", *Science Advances* **10**,eadh4053 (2024).
Leonie Neuhäuser, Michael Scholkemper, Francesco Tudisco, and Michael T. Schaub, "Learning the effective order of a hypergraph dynamical system", *Science Advances* **10**, eadh4053 (2024).

:bdg-link-primary-line:`Paper <https://doi.org/10.1126/sciadv.adh4053>`
:bdg-link-primary-line:`Code <https://git.rwth-aachen.de/netsci/publication-2023-learning-the-effective-order-of-a-hypergraph-dynamical-system>`
Expand Down Expand Up @@ -67,11 +67,17 @@ Gonzalo Contreras-Aso, Regino Criado, and Miguel Romance, "Beyond directed hyper
:bdg-link-primary-line:`Paper <https://arxiv.org/abs/2403.11825>`
:bdg-link-primary-line:`Code <https://github.com/goznalo-git/DirectedHyperCentrality>`

Robin Delabays, Giulia De Pasquale, Florian Dörfler, Yuanzhao Zhang, "Hypergraph reconstruction from dynamics", arXiv:2402.00078 (2024).
Robin Delabays, Giulia De Pasquale, Florian Dörfler, and Yuanzhao Zhang, "Hypergraph reconstruction from dynamics", arXiv:2402.00078 (2024).

:bdg-link-primary-line:`Paper <https://arxiv.org/abs/2402.00078>`
:bdg-link-primary-line:`Code <https://github.com/TaylorBasedHypergraphInference/THIS>`

Nicholas W. Landry, William Thompson, Laurent Hébert-Dufresne, and Jean-Gabriel Young, "Complex contagions can outperform simple contagions for network reconstruction with dense networks or saturated dynamics", arXiv:2405.00129

:bdg-link-primary-line:`Paper <https://arxiv.org/abs/2405.00129>`
:bdg-link-primary-line:`Code <https://github.com/nwlandry/complex-network-reconstruction>`


Maxime Lucas, Luca Gallo, Arsham Ghavasieh, Federico Battiston, and Manlio De Domenico, "Functional reducibility of higher-order networks", arXiv:2404.08547 (2024).

:bdg-link-primary-line:`Paper <https://arxiv.org/abs/2404.08547>`
Expand All @@ -90,7 +96,7 @@ Iacopo Iacopini, Márton Karsai, and Alain Barrat, "The temporal dynamics of gro
:bdg-link-primary-line:`Paper <https://arxiv.org/abs/2306.09967>`
:bdg-link-primary-line:`Code <https://github.com/iaciac/temporal-group-interactions>`

Yuanzhao Zhang, Per Sebastian Skardal, Federico Battiston, Giovanni Petri, Maxime Lucas, "Deeper but smaller: Higher-order interactions increase linear stability but shrink basins", arXiv:2309.16581 (2023).
Yuanzhao Zhang, Per Sebastian Skardal, Federico Battiston, Giovanni Petri, and Maxime Lucas, "Deeper but smaller: Higher-order interactions increase linear stability but shrink basins", arXiv:2309.16581 (2023).

:bdg-link-primary-line:`Paper <https://arxiv.org/abs/2309.16581>`
:bdg-link-primary-line:`Code <https://github.com/maximelucas/basins_and_triangles>`
Expand Down
2 changes: 0 additions & 2 deletions tests/algorithms/test_shortest_path.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import numpy as np
import pytest

import xgi
from xgi.exception import XGIError


def test_single_source_shortest_path_length(edgelist1):
Expand Down
17 changes: 10 additions & 7 deletions tests/core/test_dihypergraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def test_add_edge_warns_when_overwriting_edge_id():
H2.add_edge(([3, 4], [5, 6, 7]))
with pytest.warns(Warning):
H2.add_edge(([5, 6], [8]), id=0)
assert H2._edge_out == {0: {1, 2}, 1: {3, 4}}
assert {i: e["in"] for i, e in H2._edge.items()} == {0: {1, 2}, 1: {3, 4}}


def test_add_edge_with_id():
Expand Down Expand Up @@ -241,7 +241,7 @@ def test_add_edges_from_format2():
H1 = xgi.DiHypergraph([({1, 2}, {3}), ({2, 3, 4}, {1})])
with pytest.warns(Warning):
H1.add_edges_from([(({1, 3}, {2}), 0)])
assert H1._edge_out == {0: {1, 2}, 1: {2, 3, 4}}
assert {i: e["in"] for i, e in H1._edge.items()} == {0: {1, 2}, 1: {2, 3, 4}}


def test_add_edges_from_format3():
Expand Down Expand Up @@ -280,7 +280,7 @@ def test_add_edges_from_format4():
H1 = xgi.DiHypergraph([({1, 2}, {3}), ({2, 3, 4}, {1})])
with pytest.warns(Warning):
H1.add_edges_from([(({0, 1}, {2}), 0, {"color": "red"})])
assert H1._edge_out == {0: {1, 2}, 1: {2, 3, 4}}
assert {i: e["out"] for i, e in H1._edge.items()} == {0: {3}, 1: {1}}
nwlandry marked this conversation as resolved.
Show resolved Hide resolved


def test_add_edges_from_dict(diedgedict1):
Expand Down Expand Up @@ -388,7 +388,7 @@ def test_copy_issue128():
def test_remove_node_weak(diedgelist1, diedgelist2):
H = xgi.DiHypergraph(diedgelist1)

# node in the tail
# # node in the tail
assert 1 in H
H.remove_node(1)
assert 1 not in H
Expand Down Expand Up @@ -615,7 +615,6 @@ def test_cleanup(dihypergraph1):
assert "test" not in cleanDH
assert set(cleanDH.nodes) == {"a", "b", "c", "d"}
assert set(cleanDH.edges) == {"e1", "e2", "e3"}
edges = cleanDH.edges.dimembers()
assert cleanDH.edges.dimembers("e1") == ({"a", "b"}, {"c"})
assert cleanDH.edges.dimembers("e2") == ({"b"}, {"c", "d"})
assert cleanDH.edges.dimembers("e3") == ({"b"}, {"c"})
Expand Down Expand Up @@ -649,5 +648,9 @@ def test_cleanup(dihypergraph1):
assert cleanDH.edges.dimembers(1) == ({1}, {2, 3})
assert cleanDH.edges.dimembers(2) == ({1}, {2})

assert cleanDH._edge_in == xgi.dual_dict(cleanDH._node_out)
assert cleanDH._edge_out == xgi.dual_dict(cleanDH._node_in)
node_in = {i: n["in"] for i, n in cleanDH._node.items()}
node_out = {i: n["out"] for i, n in cleanDH._node.items()}
edge_in = {i: e["in"] for i, e in cleanDH._edge.items()}
edge_out = {i: e["out"] for i, e in cleanDH._edge.items()}
assert edge_in == xgi.dual_dict(node_out)
assert edge_out == xgi.dual_dict(node_in)
Loading
Loading