-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure folder for generators and linalg (#321)
* refact: new folder structure for linalg * refact: new folder structure for generators step 1g * fix: imports * fix: add missing files * updated codecov params to avoid annoying warnings * refact: moved more generators around * refact: merged (non)uniform random_hypergraph() and remove nonuniform file * fix: tests * PR review comments * minor adjustments * minor adjustments * docs: added missing documentation * added the uniform Erdos-Renyi back in --------- Co-authored-by: Nicholas Landry <[email protected]>
- Loading branch information
1 parent
7ee8aa2
commit 3435409
Showing
34 changed files
with
1,523 additions
and
1,297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
xgi.generators.lattice | ||
====================== | ||
|
||
.. currentmodule:: xgi.generators.lattice | ||
|
||
.. automodule:: xgi.generators.lattice | ||
|
||
.. rubric:: Functions | ||
|
||
.. autofunction:: ring_lattice |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
xgi.generators.random | ||
===================== | ||
|
||
.. currentmodule:: xgi.generators.random | ||
|
||
.. automodule:: xgi.generators.random | ||
|
||
.. rubric:: Functions | ||
|
||
.. autofunction:: chung_lu_hypergraph | ||
.. autofunction:: dcsbm_hypergraph | ||
.. autofunction:: random_hypergraph | ||
.. autofunction:: watts_strogatz_hypergraph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
xgi.generators.simple | ||
===================== | ||
|
||
.. currentmodule:: xgi.generators.simple | ||
|
||
.. automodule:: xgi.generators.simple | ||
|
||
.. rubric:: Functions | ||
|
||
.. autofunction:: star_clique | ||
.. autofunction:: sunflower |
14 changes: 14 additions & 0 deletions
14
docs/source/api/generators/xgi.generators.simplicial_complexes.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
xgi.generators.simplicial_complex | ||
================================= | ||
|
||
.. currentmodule:: xgi.generators.simplicial_complex | ||
|
||
.. automodule:: xgi.generators.simplicial_complex | ||
|
||
.. rubric:: Functions | ||
|
||
.. autofunction:: flag_complex | ||
.. autofunction:: flag_complex_d2 | ||
.. autofunction:: random_flag_complex | ||
.. autofunction:: random_flag_complex_d2 | ||
.. autofunction:: random_simplicial_complex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
xgi.linalg.hodge_matrix | ||
======================= | ||
|
||
.. currentmodule:: xgi.linalg.hodge_matrix | ||
|
||
.. automodule:: xgi.linalg.hodge_matrix | ||
|
||
.. rubric:: Functions | ||
|
||
.. autofunction:: boundary_matrix | ||
.. autofunction:: hodge_laplacian |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
xgi.linalg.hypergraph_matrix | ||
============================ | ||
|
||
.. currentmodule:: xgi.linalg.hypergraph_matrix | ||
|
||
.. automodule:: xgi.linalg.hypergraph_matrix | ||
|
||
.. rubric:: Functions | ||
|
||
.. autofunction:: adjacency_matrix | ||
.. autofunction:: clique_motif_matrix | ||
.. autofunction:: degree_matrix | ||
.. autofunction:: incidence_matrix | ||
.. autofunction:: intersection_profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
xgi.linalg.laplacian_matrix | ||
=========================== | ||
|
||
.. currentmodule:: xgi.linalg.laplacian_matrix | ||
|
||
.. automodule:: xgi.linalg.laplacian_matrix | ||
|
||
.. rubric:: Functions | ||
|
||
.. autofunction:: laplacian | ||
.. autofunction:: normalized_hypergraph_laplacian |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pytest | ||
|
||
import xgi | ||
from xgi.exception import XGIError | ||
|
||
|
||
def test_ring_lattice(): | ||
H = xgi.ring_lattice(5, 2, 2, 0) | ||
assert H.num_nodes == 5 | ||
assert H.num_edges == 5 | ||
assert xgi.unique_edge_sizes(H) == [2] | ||
|
||
H = xgi.ring_lattice(5, 3, 4, 1) | ||
edges = H.edges.members() | ||
for i in range(H.num_edges - 1): | ||
assert len(set(edges[i]).intersection(set(edges[i + 1]))) == 2 # d-l | ||
assert xgi.unique_edge_sizes(H) == [3] | ||
|
||
# k < 2 test | ||
with pytest.warns(Warning): | ||
H = xgi.ring_lattice(5, 2, 1, 0) | ||
assert H.num_nodes == 5 | ||
assert H.num_edges == 0 | ||
|
||
# k % 2 != 0 test | ||
with pytest.warns(Warning): | ||
xgi.ring_lattice(5, 2, 3, 0) | ||
|
||
# k < 0 test | ||
with pytest.raises(XGIError): | ||
xgi.ring_lattice(5, 2, -1, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.