From 507d63567b596987b2b95e40ce6e777d03dfa78b Mon Sep 17 00:00:00 2001 From: Florian Frantzen Date: Mon, 31 Mar 2025 13:30:42 +0200 Subject: [PATCH 1/2] Rename `complex` variables to `domain` The old name shadows the built-in `complex` class for complex numbers. --- topoembedx/classes/cell2vec.py | 6 +++--- topoembedx/classes/cell_diff2vec.py | 6 +++--- topoembedx/classes/deepcell.py | 6 +++--- .../higher_order_laplacian_eigenmaps.py | 6 +++--- topoembedx/classes/hoglee.py | 6 +++--- topoembedx/classes/hope.py | 6 +++--- topoembedx/neighborhood.py | 20 +++++++++---------- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/topoembedx/classes/cell2vec.py b/topoembedx/classes/cell2vec.py index f0cc229..80e1aae 100644 --- a/topoembedx/classes/cell2vec.py +++ b/topoembedx/classes/cell2vec.py @@ -93,7 +93,7 @@ def __init__( def fit( self, - complex: tnx.Complex, + domain: tnx.Complex, neighborhood_type: Literal["adj", "coadj"] = "adj", neighborhood_dim=None, ) -> None: @@ -101,7 +101,7 @@ def fit( Parameters ---------- - complex : toponetx.classes.Complex + domain : toponetx.classes.Complex A complex object. The complex object can be one of the following: - CellComplex - CombinatorialComplex @@ -128,7 +128,7 @@ def fit( colored hypergraph. """ self.ind, self.A = neighborhood_from_complex( - complex, neighborhood_type, neighborhood_dim + domain, neighborhood_type, neighborhood_dim ) g = nx.from_numpy_array(self.A) diff --git a/topoembedx/classes/cell_diff2vec.py b/topoembedx/classes/cell_diff2vec.py index 07e1fd8..4487205 100644 --- a/topoembedx/classes/cell_diff2vec.py +++ b/topoembedx/classes/cell_diff2vec.py @@ -73,7 +73,7 @@ def __init__( def fit( self, - complex: tnx.Complex, + domain: tnx.Complex, neighborhood_type: Literal["adj", "coadj"] = "adj", neighborhood_dim=None, ) -> None: @@ -81,7 +81,7 @@ def fit( Parameters ---------- - complex : toponetx.classes.Complex + domain : toponetx.classes.Complex A complex object. The complex object can be one of the following: - CellComplex - CombinatorialComplex @@ -108,7 +108,7 @@ def fit( colored hypergraph. """ self.ind, self.A = neighborhood_from_complex( - complex, neighborhood_type, neighborhood_dim + domain, neighborhood_type, neighborhood_dim ) self.A.setdiag(1) diff --git a/topoembedx/classes/deepcell.py b/topoembedx/classes/deepcell.py index 2d3881b..b9cbbb2 100644 --- a/topoembedx/classes/deepcell.py +++ b/topoembedx/classes/deepcell.py @@ -73,7 +73,7 @@ def __init__( def fit( self, - complex: tnx.Complex, + domain: tnx.Complex, neighborhood_type: Literal["adj", "coadj"] = "adj", neighborhood_dim=None, ) -> None: @@ -81,7 +81,7 @@ def fit( Parameters ---------- - complex : toponetx.classes.Complex + domain : toponetx.classes.Complex A complex object. The complex object can be one of the following: - CellComplex - CombinatorialComplex @@ -108,7 +108,7 @@ def fit( colored hypergraph. """ self.ind, self.A = neighborhood_from_complex( - complex, neighborhood_type, neighborhood_dim + domain, neighborhood_type, neighborhood_dim ) self.A.setdiag(1) diff --git a/topoembedx/classes/higher_order_laplacian_eigenmaps.py b/topoembedx/classes/higher_order_laplacian_eigenmaps.py index c724401..3be4211 100644 --- a/topoembedx/classes/higher_order_laplacian_eigenmaps.py +++ b/topoembedx/classes/higher_order_laplacian_eigenmaps.py @@ -38,7 +38,7 @@ def __init__( def fit( self, - complex: tnx.Complex, + domain: tnx.Complex, neighborhood_type: Literal["adj", "coadj"] = "adj", neighborhood_dim=None, ) -> None: @@ -46,7 +46,7 @@ def fit( Parameters ---------- - complex : toponetx.classes.Complex + domain : toponetx.classes.Complex A complex object. The complex object can be one of the following: - CellComplex - CombinatorialComplex @@ -73,7 +73,7 @@ def fit( colored hypergraph. """ self.ind, self.A = neighborhood_from_complex( - complex, neighborhood_type, neighborhood_dim + domain, neighborhood_type, neighborhood_dim ) self.A.setdiag(1) diff --git a/topoembedx/classes/hoglee.py b/topoembedx/classes/hoglee.py index 5c70907..618498d 100644 --- a/topoembedx/classes/hoglee.py +++ b/topoembedx/classes/hoglee.py @@ -30,7 +30,7 @@ def __init__(self, dimensions: int = 128, seed: int = 42): def fit( self, - complex: tnx.Complex, + domain: tnx.Complex, neighborhood_type: Literal["adj", "coadj"] = "adj", neighborhood_dim=None, ) -> None: @@ -38,7 +38,7 @@ def fit( Parameters ---------- - complex : toponetx.classes.Complex + domain : toponetx.classes.Complex A complex object. The complex object can be one of the following: - CellComplex - CombinatorialComplex @@ -65,7 +65,7 @@ def fit( colored hypergraph. """ self.ind, self.A = neighborhood_from_complex( - complex, neighborhood_type, neighborhood_dim + domain, neighborhood_type, neighborhood_dim ) self.A.setdiag(1) diff --git a/topoembedx/classes/hope.py b/topoembedx/classes/hope.py index 9c0e99a..93fbeb9 100644 --- a/topoembedx/classes/hope.py +++ b/topoembedx/classes/hope.py @@ -114,7 +114,7 @@ def _laplacian_pe( def fit( self, - complex: tnx.Complex, + domain: tnx.Complex, neighborhood_type: Literal["adj", "coadj"] = "adj", neighborhood_dim: dict | None = None, ) -> None: @@ -122,7 +122,7 @@ def fit( Parameters ---------- - complex : toponetx.classes.Complex + domain : toponetx.classes.Complex A complex object. The complex object can be one of the following: - CellComplex - CombinatorialComplex @@ -165,7 +165,7 @@ def fit( >>> em = model.get_embedding(get_dict=True) """ self.ind, self.A = neighborhood_from_complex( - complex, neighborhood_type, neighborhood_dim + domain, neighborhood_type, neighborhood_dim ) self._embedding = self._laplacian_pe(self.A, self.dimensions) diff --git a/topoembedx/neighborhood.py b/topoembedx/neighborhood.py index 089291f..badc7e2 100644 --- a/topoembedx/neighborhood.py +++ b/topoembedx/neighborhood.py @@ -7,7 +7,7 @@ def neighborhood_from_complex( - complex: tnx.Complex, + domain: tnx.Complex, neighborhood_type: Literal["adj", "coadj"] = "adj", neighborhood_dim=None, ) -> tuple[list, csr_matrix]: @@ -15,11 +15,11 @@ def neighborhood_from_complex( This function returns the indices and matrix for the neighborhood specified by `neighborhood_type` - and `neighborhood_dim` for the input complex `complex`. + and `neighborhood_dim` for the input complex `domain`. Parameters ---------- - complex : toponetx.classes.Complex + domain : toponetx.classes.Complex The complex to compute the neighborhood for. neighborhood_type : {"adj", "coadj"}, default="adj" The type of neighborhood to compute. "adj" for adjacency matrix, "coadj" for coadjacency matrix. @@ -50,7 +50,7 @@ def neighborhood_from_complex( Raises ------ TypeError - If `complex` is not a SimplicialComplex, CellComplex, PathComplex ColoredHyperGraph or CombinatorialComplex. + If `domain` is not a SimplicialComplex, CellComplex, PathComplex ColoredHyperGraph or CombinatorialComplex. TypeError If `neighborhood_type` is invalid. """ @@ -62,18 +62,18 @@ def neighborhood_from_complex( f"Input neighborhood_type must be `adj` or `coadj`, got {neighborhood_type}." ) - if isinstance(complex, tnx.SimplicialComplex | tnx.CellComplex | tnx.PathComplex): + if isinstance(domain, tnx.SimplicialComplex | tnx.CellComplex | tnx.PathComplex): if neighborhood_type == "adj": - ind, A = complex.adjacency_matrix(neighborhood_dim["rank"], index=True) + ind, A = domain.adjacency_matrix(neighborhood_dim["rank"], index=True) else: - ind, A = complex.coadjacency_matrix(neighborhood_dim["rank"], index=True) - elif isinstance(complex, tnx.CombinatorialComplex | tnx.ColoredHyperGraph): + ind, A = domain.coadjacency_matrix(neighborhood_dim["rank"], index=True) + elif isinstance(domain, tnx.CombinatorialComplex | tnx.ColoredHyperGraph): if neighborhood_type == "adj": - ind, A = complex.adjacency_matrix( + ind, A = domain.adjacency_matrix( neighborhood_dim["rank"], neighborhood_dim["via_rank"], index=True ) else: - ind, A = complex.coadjacency_matrix( + ind, A = domain.coadjacency_matrix( neighborhood_dim["rank"], neighborhood_dim["via_rank"], index=True ) else: From 851fee14f8366633d6646de68ec6959a70c43aa2 Mon Sep 17 00:00:00 2001 From: Florian Frantzen Date: Mon, 31 Mar 2025 14:40:37 +0200 Subject: [PATCH 2/2] Activate additional ruff rules --- conftest.py | 30 +++++++++++++++++ docs/conf.py | 2 +- pyproject.toml | 33 +++++++++++++++++-- test/test_neighborhood.py | 8 ++--- test/test_tutorials.py | 21 +++++++++--- topoembedx/__init__.py | 7 +--- topoembedx/classes/__init__.py | 8 +++++ topoembedx/classes/cell2vec.py | 2 +- topoembedx/classes/cell_diff2vec.py | 2 +- topoembedx/classes/deepcell.py | 2 +- .../higher_order_laplacian_eigenmaps.py | 2 +- topoembedx/classes/hoglee.py | 2 +- topoembedx/classes/hope.py | 3 +- topoembedx/classes/random_walks.py | 13 +++----- topoembedx/{exceptions.py => exception.py} | 4 ++- topoembedx/neighborhood.py | 7 ++-- 16 files changed, 109 insertions(+), 37 deletions(-) create mode 100644 conftest.py rename topoembedx/{exceptions.py => exception.py} (69%) diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..b70ad41 --- /dev/null +++ b/conftest.py @@ -0,0 +1,30 @@ +"""Configure our testing suite.""" + +import networkx as nx +import numpy as np +import pytest +import toponetx as tnx + + +@pytest.fixture(autouse=True) +def doctest_default_imports(doctest_namespace) -> None: + """Add default imports to the doctest namespace. + + This fixture adds the following default imports to every doctest, so that their use + is consistent across all doctests without boilerplate imports polluting the + doctests themselves: + + .. code-block:: python + + import numpy as np + import networkx as nx + import toponetx as tnx + + Parameters + ---------- + doctest_namespace : dict + The namespace of the doctest. + """ + doctest_namespace["np"] = np + doctest_namespace["nx"] = nx + doctest_namespace["tnx"] = tnx diff --git a/docs/conf.py b/docs/conf.py index 765b666..37490c2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -3,7 +3,7 @@ # -- Project information ----------------------------------------------------- project = "TopoEmbedX" -copyright = "2022-2023, PyT-Team, Inc." +copyright = "2022-2023, PyT-Team, Inc." # noqa: A001 author = "PyT-Team Authors" language = "en" diff --git a/pyproject.toml b/pyproject.toml index 1db4ffc..afdc483 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -113,20 +113,49 @@ select = [ "E", # code style "W", # warnings "I", # import order + "D", # pydocstyle rules "UP", # pyupgrade rules + "YTT", # flake8-2020 rules + "S", # bandit rules + "BLE", # blind except "B", # bugbear rules + "A", # builtin shadowing + "COM", # comma rules + "C4", # comprehensions + "DTZ", # datetime rules + "T10", # debugger calls + "FA", # future annotations + "ISC", # implicit str concatenation + "ICN", # import conventions + "LOG", # logging rules + "G", # logging format rules "PIE", # pie rules "Q", # quote rules + "RSE", # raise rules "RET", # return rules + "SLOT", # slot rules "SIM", # code simplifications + "TID", # tidy imports + "TC", # type checking rules + "PTH", # use pathlib + "PD", # pandas rules + "PLC", # pylint conventions + "PLE", # pylint errors + "FLY", # flynt "NPY", # numpy rules "PERF", # performance rules + "FURB", # refurb "RUF", # miscellaneous rules ] -ignore = ["E501"] # line too long +ignore = [ + "E501", # line too long + "COM812", # trailing commas; conflict with `ruff format` + "ISC001", # implicitly single-line str concat; conflict with `ruff format` +] [tool.ruff.lint.per-file-ignores] -"__init__.py" = ["F401", "F403"] +"__init__.py" = ["F403"] +"test/**.py" = ["S101"] [tool.ruff.lint.pydocstyle] convention = "numpy" diff --git a/test/test_neighborhood.py b/test/test_neighborhood.py index 2302330..54c5141 100644 --- a/test/test_neighborhood.py +++ b/test/test_neighborhood.py @@ -29,21 +29,21 @@ def test_neighborhood_from_complex_matrix_dimension_cell_complex(self): cc2 = tnx.classes.CellComplex([[0, 1, 2], [1, 2, 3]]) ind, A = tex.neighborhood.neighborhood_from_complex(cc1) - assert A.todense().shape == tuple([9, 9]) + assert A.todense().shape == (9, 9) assert len(ind) == 9 ind, A = tex.neighborhood.neighborhood_from_complex(cc2) - assert A.todense().shape == tuple([4, 4]) + assert A.todense().shape == (4, 4) assert len(ind) == 4 ind, A = tex.neighborhood.neighborhood_from_complex( cc1, neighborhood_type="coadj" ) - assert A.todense().shape == tuple([9, 9]) + assert A.todense().shape == (9, 9) assert len(ind) == 9 ind, A = tex.neighborhood.neighborhood_from_complex( cc2, neighborhood_type="coadj" ) - assert A.todense().shape == tuple([4, 4]) + assert A.todense().shape == (4, 4) assert len(ind) == 4 diff --git a/test/test_tutorials.py b/test/test_tutorials.py index d5ed160..aa6f53a 100644 --- a/test/test_tutorials.py +++ b/test/test_tutorials.py @@ -1,13 +1,20 @@ """Unit tests for the tutorials.""" -import glob import subprocess import tempfile +from pathlib import Path import pytest def _exec_tutorial(path): + """Execute the notebooks for testing in the given directory. + + Parameters + ---------- + path : str + Path to the tutorials directory. + """ with tempfile.NamedTemporaryFile(suffix=".ipynb") as tmp_file: args = [ "jupyter", @@ -21,14 +28,20 @@ def _exec_tutorial(path): tmp_file.name, path, ] - subprocess.check_call(args) + subprocess.check_call(args) # noqa: S603 TUTORIALS_DIR = "tutorials" -paths = sorted(glob.glob(f"{TUTORIALS_DIR}/*.ipynb")) +paths = sorted(Path(TUTORIALS_DIR).glob("*.ipynb")) @pytest.mark.parametrize("path", paths) def test_tutorial(path): - """Test the tutorials.""" + """Test the tutorials. + + Parameters + ---------- + path : str + Path to the tutorials directory. + """ _exec_tutorial(path) diff --git a/topoembedx/__init__.py b/topoembedx/__init__.py index 8a56802..08392f5 100644 --- a/topoembedx/__init__.py +++ b/topoembedx/__init__.py @@ -1,8 +1,3 @@ """Initialize the library with modules and other content.""" -from .classes.cell2vec import Cell2Vec -from .classes.cell_diff2vec import CellDiff2Vec -from .classes.deepcell import DeepCell -from .classes.higher_order_laplacian_eigenmaps import HigherOrderLaplacianEigenmaps -from .classes.hoglee import HOGLEE -from .classes.hope import HOPE +from .classes import * diff --git a/topoembedx/classes/__init__.py b/topoembedx/classes/__init__.py index fc63c89..9a6d7b9 100644 --- a/topoembedx/classes/__init__.py +++ b/topoembedx/classes/__init__.py @@ -1 +1,9 @@ """Initialize the classes module of TopoEmbedX.""" + +from .cell2vec import * +from .cell_diff2vec import * +from .deepcell import * +from .higher_order_laplacian_eigenmaps import * +from .hoglee import * +from .hope import * +from .random_walks import * diff --git a/topoembedx/classes/cell2vec.py b/topoembedx/classes/cell2vec.py index 80e1aae..36fff4d 100644 --- a/topoembedx/classes/cell2vec.py +++ b/topoembedx/classes/cell2vec.py @@ -111,7 +111,7 @@ def fit( neighborhood_type : {"adj", "coadj"}, default="adj" The type of neighborhood to compute. "adj" for adjacency matrix, "coadj" for coadjacency matrix. neighborhood_dim : dict - The integer parmaters needed to specify the neighborhood of the cells to generate the embedding. + The integer parameters needed to specify the neighborhood of the cells to generate the embedding. In TopoNetX (co)adjacency neighborhood matrices are specified via one or two parameters. - For Cell/Simplicial/Path complexes (co)adjacency matrix is specified by a single parameter, this is precisely neighborhood_dim["rank"]. diff --git a/topoembedx/classes/cell_diff2vec.py b/topoembedx/classes/cell_diff2vec.py index 4487205..0fd87cf 100644 --- a/topoembedx/classes/cell_diff2vec.py +++ b/topoembedx/classes/cell_diff2vec.py @@ -91,7 +91,7 @@ def fit( neighborhood_type : {"adj", "coadj"}, default="adj" The type of neighborhood to compute. "adj" for adjacency matrix, "coadj" for coadjacency matrix. neighborhood_dim : dict - The integer parmaters needed to specify the neighborhood of the cells to generate the embedding. + The integer parameters needed to specify the neighborhood of the cells to generate the embedding. In TopoNetX (co)adjacency neighborhood matrices are specified via one or two parameters. - For Cell/Simplicial/Path complexes (co)adjacency matrix is specified by a single parameter, this is precisely neighborhood_dim["rank"]. diff --git a/topoembedx/classes/deepcell.py b/topoembedx/classes/deepcell.py index b9cbbb2..f443179 100644 --- a/topoembedx/classes/deepcell.py +++ b/topoembedx/classes/deepcell.py @@ -91,7 +91,7 @@ def fit( neighborhood_type : {"adj", "coadj"}, default="adj" The type of neighborhood to compute. "adj" for adjacency matrix, "coadj" for coadjacency matrix. neighborhood_dim : dict - The integer parmaters needed to specify the neighborhood of the cells to generate the embedding. + The integer parameters needed to specify the neighborhood of the cells to generate the embedding. In TopoNetX (co)adjacency neighborhood matrices are specified via one or two parameters. - For Cell/Simplicial/Path complexes (co)adjacency matrix is specified by a single parameter, this is precisely neighborhood_dim["rank"]. diff --git a/topoembedx/classes/higher_order_laplacian_eigenmaps.py b/topoembedx/classes/higher_order_laplacian_eigenmaps.py index 3be4211..21742c9 100644 --- a/topoembedx/classes/higher_order_laplacian_eigenmaps.py +++ b/topoembedx/classes/higher_order_laplacian_eigenmaps.py @@ -56,7 +56,7 @@ def fit( neighborhood_type : {"adj", "coadj"}, default="adj" The type of neighborhood to compute. "adj" for adjacency matrix, "coadj" for coadjacency matrix. neighborhood_dim : dict - The integer parmaters needed to specify the neighborhood of the cells to generate the embedding. + The integer parameters needed to specify the neighborhood of the cells to generate the embedding. In TopoNetX (co)adjacency neighborhood matrices are specified via one or two parameters. - For Cell/Simplicial/Path complexes (co)adjacency matrix is specified by a single parameter, this is precisely neighborhood_dim["rank"]. diff --git a/topoembedx/classes/hoglee.py b/topoembedx/classes/hoglee.py index 618498d..3064ebe 100644 --- a/topoembedx/classes/hoglee.py +++ b/topoembedx/classes/hoglee.py @@ -48,7 +48,7 @@ def fit( neighborhood_type : {"adj", "coadj"}, default="adj" The type of neighborhood to compute. "adj" for adjacency matrix, "coadj" for coadjacency matrix. neighborhood_dim : dict - The integer parmaters needed to specify the neighborhood of the cells to generate the embedding. + The integer parameters needed to specify the neighborhood of the cells to generate the embedding. In TopoNetX (co)adjacency neighborhood matrices are specified via one or two parameters. - For Cell/Simplicial/Path complexes (co)adjacency matrix is specified by a single parameter, this is precisely neighborhood_dim["rank"]. diff --git a/topoembedx/classes/hope.py b/topoembedx/classes/hope.py index 93fbeb9..3184c97 100644 --- a/topoembedx/classes/hope.py +++ b/topoembedx/classes/hope.py @@ -146,9 +146,8 @@ def fit( Examples -------- - >>> import toponetx as tnx >>> from topoembedx import HOPE - >>> ccc = tnx.classes.CombinatorialComplex() + >>> ccc = tnx.CombinatorialComplex() >>> ccc.add_cell([2, 5], rank=1) >>> ccc.add_cell([2, 4], rank=1) >>> ccc.add_cell([7, 8], rank=1) diff --git a/topoembedx/classes/random_walks.py b/topoembedx/classes/random_walks.py index 334e697..417e659 100644 --- a/topoembedx/classes/random_walks.py +++ b/topoembedx/classes/random_walks.py @@ -43,10 +43,10 @@ def transition_from_adjacency( This function generates a transition matrix from an adjacency matrix using the following steps: - 1. Add self-loop to the adjaency matrix if self_loop is set to True - 2. Compute the degree matrix + 1. Add self-loop to the adjacency matrix if ``self_loop`` is set to ``True``. + 2. Compute the degree matrix. 3. Compute the transition matrix by taking the dot product of the inverse of - the degree matrix and the adjacency matrix + the degree matrix and the adjacency matrix. Parameters ---------- @@ -55,7 +55,7 @@ def transition_from_adjacency( sub_sampling : float, default=0.1 The rate of subsampling. self_loop : bool, default=True - A flag indicating whether to add self-loop to the adjacency matrix. + Whether to add self-loops to the adjacency matrix. Returns ------- @@ -64,7 +64,6 @@ def transition_from_adjacency( Examples -------- - >>> import numpy as np >>> A = np.array([[0, 1, 1, 0], [1, 0, 1, 0], [1, 1, 0, 1], [0, 0, 1, 0]]) >>> transition_from_adjacency(A) array([[0.33333333, 0.33333333, 0.33333333, 0. ], @@ -165,7 +164,6 @@ def random_walk( Examples -------- - >>> import numpy as np >>> transition_matrix = np.array( ... [ ... [0.0, 1.0, 0.0, 0.0], @@ -175,10 +173,9 @@ def random_walk( ... ] ... ) >>> states = ["A", "B", "C", "D"] - >>> walks = random_walk( + >>> random_walk( ... length=3, num_walks=2, states=states, transition_matrix=transition_matrix ... ) - >>> print(walks) [['B', 'C', 'D'], ['B', 'C', 'B']] """ rw = RandomWalk(states, transition_matrix) diff --git a/topoembedx/exceptions.py b/topoembedx/exception.py similarity index 69% rename from topoembedx/exceptions.py rename to topoembedx/exception.py index e8bb8f2..f64e434 100644 --- a/topoembedx/exceptions.py +++ b/topoembedx/exception.py @@ -1,4 +1,6 @@ -"""Base classes for TopoEmbedX exceptions.""" +"""Base errors and exceptions for TopoEmbedX.""" + +__all__ = ["TopoEmbedXError", "TopoEmbedXException", "TopoEmbedXNotImplementedError"] class TopoEmbedXException(Exception): diff --git a/topoembedx/neighborhood.py b/topoembedx/neighborhood.py index badc7e2..0817f50 100644 --- a/topoembedx/neighborhood.py +++ b/topoembedx/neighborhood.py @@ -13,9 +13,8 @@ def neighborhood_from_complex( ) -> tuple[list, csr_matrix]: """Compute the neighborhood of a complex. - This function returns the indices and matrix for the neighborhood specified - by `neighborhood_type` - and `neighborhood_dim` for the input complex `domain`. + This function returns the indices and matrix for the neighborhood specified by + `neighborhood_type` and `neighborhood_dim` for the input complex `domain`. Parameters ---------- @@ -24,7 +23,7 @@ def neighborhood_from_complex( neighborhood_type : {"adj", "coadj"}, default="adj" The type of neighborhood to compute. "adj" for adjacency matrix, "coadj" for coadjacency matrix. neighborhood_dim : dict - The integer parmaters needed to specify the neighborhood of the cells to generate the embedding. + The integer parameters needed to specify the neighborhood of the cells to generate the embedding. In TopoNetX (co)adjacency neighborhood matrices are specified via one or two parameters. - For Cell/Simplicial/Path complexes (co)adjacency matrix is specified by a single parameter, this is precisely neighborhood_dim["rank"].