7
7
8
8
9
9
def neighborhood_from_complex (
10
- complex : tnx .Complex ,
10
+ domain : tnx .Complex ,
11
11
neighborhood_type : Literal ["adj" , "coadj" ] = "adj" ,
12
12
neighborhood_dim = None ,
13
13
) -> tuple [list , csr_matrix ]:
14
14
"""Compute the neighborhood of a complex.
15
15
16
16
This function returns the indices and matrix for the neighborhood specified
17
17
by `neighborhood_type`
18
- and `neighborhood_dim` for the input complex `complex `.
18
+ and `neighborhood_dim` for the input complex `domain `.
19
19
20
20
Parameters
21
21
----------
22
- complex : toponetx.classes.Complex
22
+ domain : toponetx.classes.Complex
23
23
The complex to compute the neighborhood for.
24
24
neighborhood_type : {"adj", "coadj"}, default="adj"
25
25
The type of neighborhood to compute. "adj" for adjacency matrix, "coadj" for coadjacency matrix.
@@ -50,7 +50,7 @@ def neighborhood_from_complex(
50
50
Raises
51
51
------
52
52
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.
54
54
TypeError
55
55
If `neighborhood_type` is invalid.
56
56
"""
@@ -62,18 +62,18 @@ def neighborhood_from_complex(
62
62
f"Input neighborhood_type must be `adj` or `coadj`, got { neighborhood_type } ."
63
63
)
64
64
65
- if isinstance (complex , tnx .SimplicialComplex | tnx .CellComplex | tnx .PathComplex ):
65
+ if isinstance (domain , tnx .SimplicialComplex | tnx .CellComplex | tnx .PathComplex ):
66
66
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 )
68
68
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 ):
71
71
if neighborhood_type == "adj" :
72
- ind , A = complex .adjacency_matrix (
72
+ ind , A = domain .adjacency_matrix (
73
73
neighborhood_dim ["rank" ], neighborhood_dim ["via_rank" ], index = True
74
74
)
75
75
else :
76
- ind , A = complex .coadjacency_matrix (
76
+ ind , A = domain .coadjacency_matrix (
77
77
neighborhood_dim ["rank" ], neighborhood_dim ["via_rank" ], index = True
78
78
)
79
79
else :
0 commit comments