Skip to content

Commit 507d635

Browse files
committed
Rename complex variables to domain
The old name shadows the built-in `complex` class for complex numbers.
1 parent c2c70ad commit 507d635

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

topoembedx/classes/cell2vec.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ def __init__(
9393

9494
def fit(
9595
self,
96-
complex: tnx.Complex,
96+
domain: tnx.Complex,
9797
neighborhood_type: Literal["adj", "coadj"] = "adj",
9898
neighborhood_dim=None,
9999
) -> None:
100100
"""Fit a Cell2Vec model.
101101
102102
Parameters
103103
----------
104-
complex : toponetx.classes.Complex
104+
domain : toponetx.classes.Complex
105105
A complex object. The complex object can be one of the following:
106106
- CellComplex
107107
- CombinatorialComplex
@@ -128,7 +128,7 @@ def fit(
128128
colored hypergraph.
129129
"""
130130
self.ind, self.A = neighborhood_from_complex(
131-
complex, neighborhood_type, neighborhood_dim
131+
domain, neighborhood_type, neighborhood_dim
132132
)
133133

134134
g = nx.from_numpy_array(self.A)

topoembedx/classes/cell_diff2vec.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ def __init__(
7373

7474
def fit(
7575
self,
76-
complex: tnx.Complex,
76+
domain: tnx.Complex,
7777
neighborhood_type: Literal["adj", "coadj"] = "adj",
7878
neighborhood_dim=None,
7979
) -> None:
8080
"""Fit a CellDiff2Vec model.
8181
8282
Parameters
8383
----------
84-
complex : toponetx.classes.Complex
84+
domain : toponetx.classes.Complex
8585
A complex object. The complex object can be one of the following:
8686
- CellComplex
8787
- CombinatorialComplex
@@ -108,7 +108,7 @@ def fit(
108108
colored hypergraph.
109109
"""
110110
self.ind, self.A = neighborhood_from_complex(
111-
complex, neighborhood_type, neighborhood_dim
111+
domain, neighborhood_type, neighborhood_dim
112112
)
113113

114114
self.A.setdiag(1)

topoembedx/classes/deepcell.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ def __init__(
7373

7474
def fit(
7575
self,
76-
complex: tnx.Complex,
76+
domain: tnx.Complex,
7777
neighborhood_type: Literal["adj", "coadj"] = "adj",
7878
neighborhood_dim=None,
7979
) -> None:
8080
"""Fit the model.
8181
8282
Parameters
8383
----------
84-
complex : toponetx.classes.Complex
84+
domain : toponetx.classes.Complex
8585
A complex object. The complex object can be one of the following:
8686
- CellComplex
8787
- CombinatorialComplex
@@ -108,7 +108,7 @@ def fit(
108108
colored hypergraph.
109109
"""
110110
self.ind, self.A = neighborhood_from_complex(
111-
complex, neighborhood_type, neighborhood_dim
111+
domain, neighborhood_type, neighborhood_dim
112112
)
113113

114114
self.A.setdiag(1)

topoembedx/classes/higher_order_laplacian_eigenmaps.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ def __init__(
3838

3939
def fit(
4040
self,
41-
complex: tnx.Complex,
41+
domain: tnx.Complex,
4242
neighborhood_type: Literal["adj", "coadj"] = "adj",
4343
neighborhood_dim=None,
4444
) -> None:
4545
"""Fit a Higher Order Laplacian Eigenmaps model.
4646
4747
Parameters
4848
----------
49-
complex : toponetx.classes.Complex
49+
domain : toponetx.classes.Complex
5050
A complex object. The complex object can be one of the following:
5151
- CellComplex
5252
- CombinatorialComplex
@@ -73,7 +73,7 @@ def fit(
7373
colored hypergraph.
7474
"""
7575
self.ind, self.A = neighborhood_from_complex(
76-
complex, neighborhood_type, neighborhood_dim
76+
domain, neighborhood_type, neighborhood_dim
7777
)
7878

7979
self.A.setdiag(1)

topoembedx/classes/hoglee.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ def __init__(self, dimensions: int = 128, seed: int = 42):
3030

3131
def fit(
3232
self,
33-
complex: tnx.Complex,
33+
domain: tnx.Complex,
3434
neighborhood_type: Literal["adj", "coadj"] = "adj",
3535
neighborhood_dim=None,
3636
) -> None:
3737
"""Fit a Higher Order Geometric Laplacian EigenMaps model.
3838
3939
Parameters
4040
----------
41-
complex : toponetx.classes.Complex
41+
domain : toponetx.classes.Complex
4242
A complex object. The complex object can be one of the following:
4343
- CellComplex
4444
- CombinatorialComplex
@@ -65,7 +65,7 @@ def fit(
6565
colored hypergraph.
6666
"""
6767
self.ind, self.A = neighborhood_from_complex(
68-
complex, neighborhood_type, neighborhood_dim
68+
domain, neighborhood_type, neighborhood_dim
6969
)
7070

7171
self.A.setdiag(1)

topoembedx/classes/hope.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ def _laplacian_pe(
114114

115115
def fit(
116116
self,
117-
complex: tnx.Complex,
117+
domain: tnx.Complex,
118118
neighborhood_type: Literal["adj", "coadj"] = "adj",
119119
neighborhood_dim: dict | None = None,
120120
) -> None:
121121
"""Fit a Higher Order Geometric Laplacian EigenMaps model.
122122
123123
Parameters
124124
----------
125-
complex : toponetx.classes.Complex
125+
domain : toponetx.classes.Complex
126126
A complex object. The complex object can be one of the following:
127127
- CellComplex
128128
- CombinatorialComplex
@@ -165,7 +165,7 @@ def fit(
165165
>>> em = model.get_embedding(get_dict=True)
166166
"""
167167
self.ind, self.A = neighborhood_from_complex(
168-
complex, neighborhood_type, neighborhood_dim
168+
domain, neighborhood_type, neighborhood_dim
169169
)
170170

171171
self._embedding = self._laplacian_pe(self.A, self.dimensions)

topoembedx/neighborhood.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77

88

99
def neighborhood_from_complex(
10-
complex: tnx.Complex,
10+
domain: tnx.Complex,
1111
neighborhood_type: Literal["adj", "coadj"] = "adj",
1212
neighborhood_dim=None,
1313
) -> tuple[list, csr_matrix]:
1414
"""Compute the neighborhood of a complex.
1515
1616
This function returns the indices and matrix for the neighborhood specified
1717
by `neighborhood_type`
18-
and `neighborhood_dim` for the input complex `complex`.
18+
and `neighborhood_dim` for the input complex `domain`.
1919
2020
Parameters
2121
----------
22-
complex : toponetx.classes.Complex
22+
domain : toponetx.classes.Complex
2323
The complex to compute the neighborhood for.
2424
neighborhood_type : {"adj", "coadj"}, default="adj"
2525
The type of neighborhood to compute. "adj" for adjacency matrix, "coadj" for coadjacency matrix.
@@ -50,7 +50,7 @@ def neighborhood_from_complex(
5050
Raises
5151
------
5252
TypeError
53-
If `complex` is not a SimplicialComplex, CellComplex, PathComplex ColoredHyperGraph or CombinatorialComplex.
53+
If `domain` is not a SimplicialComplex, CellComplex, PathComplex ColoredHyperGraph or CombinatorialComplex.
5454
TypeError
5555
If `neighborhood_type` is invalid.
5656
"""
@@ -62,18 +62,18 @@ def neighborhood_from_complex(
6262
f"Input neighborhood_type must be `adj` or `coadj`, got {neighborhood_type}."
6363
)
6464

65-
if isinstance(complex, tnx.SimplicialComplex | tnx.CellComplex | tnx.PathComplex):
65+
if isinstance(domain, tnx.SimplicialComplex | tnx.CellComplex | tnx.PathComplex):
6666
if neighborhood_type == "adj":
67-
ind, A = complex.adjacency_matrix(neighborhood_dim["rank"], index=True)
67+
ind, A = domain.adjacency_matrix(neighborhood_dim["rank"], index=True)
6868
else:
69-
ind, A = complex.coadjacency_matrix(neighborhood_dim["rank"], index=True)
70-
elif isinstance(complex, tnx.CombinatorialComplex | tnx.ColoredHyperGraph):
69+
ind, A = domain.coadjacency_matrix(neighborhood_dim["rank"], index=True)
70+
elif isinstance(domain, tnx.CombinatorialComplex | tnx.ColoredHyperGraph):
7171
if neighborhood_type == "adj":
72-
ind, A = complex.adjacency_matrix(
72+
ind, A = domain.adjacency_matrix(
7373
neighborhood_dim["rank"], neighborhood_dim["via_rank"], index=True
7474
)
7575
else:
76-
ind, A = complex.coadjacency_matrix(
76+
ind, A = domain.coadjacency_matrix(
7777
neighborhood_dim["rank"], neighborhood_dim["via_rank"], index=True
7878
)
7979
else:

0 commit comments

Comments
 (0)