1
+
1
2
import networkx as nx
2
3
import torch
3
- from typing import Tuple , Set , List
4
4
from torch_geometric .utils .convert import from_networkx
5
5
6
6
from modules .data .utils .utils import load_manual_graph
@@ -37,7 +37,7 @@ def setup_method(self):
37
37
self .random_data ["x" ] = torch .rand ((5 , 1 ))
38
38
39
39
40
- def has_neighbour (self , simplex_points : List [ Set ]) -> Tuple [bool , Set [int ]]:
40
+ def has_neighbour (self , simplex_points : list [ set ]) -> tuple [bool , set [int ]]:
41
41
""" Verifies that the maximal simplices
42
42
of Data representation of a simplicial complex
43
43
share a neighbour.
@@ -61,10 +61,10 @@ def test_lift_topology_random_graph(self):
61
61
"""
62
62
lifted_data = self .lifting_high .forward (self .random_data )
63
63
# For each set of simplices
64
- r = max (int (key .split ('_' )[- 1 ]) for key in list (lifted_data .keys ()) if ' x_idx_' in key )
64
+ r = max (int (key .split ("_" )[- 1 ]) for key in list (lifted_data .keys ()) if " x_idx_" in key )
65
65
idx_str = f"x_idx_{ r } "
66
66
67
- # Go over each (max_dim)-simplex
67
+ # Go over each (max_dim)-simplex
68
68
for simplex_points in lifted_data [idx_str ]:
69
69
share_neighbour = self .has_neighbour (simplex_points )
70
70
assert share_neighbour , f"The simplex { simplex_points } does not have a common neighbour with all the nodes."
@@ -76,10 +76,10 @@ def test_lift_topology_star_graph(self):
76
76
"""
77
77
lifted_data = self .lifting_high .forward (self .star_data )
78
78
# For each set of simplices
79
- r = max (int (key .split ('_' )[- 1 ]) for key in list (lifted_data .keys ()) if ' x_idx_' in key )
79
+ r = max (int (key .split ("_" )[- 1 ]) for key in list (lifted_data .keys ()) if " x_idx_" in key )
80
80
idx_str = f"x_idx_{ r } "
81
81
82
- # Go over each (max_dim)-simplex
82
+ # Go over each (max_dim)-simplex
83
83
for simplex_points in lifted_data [idx_str ]:
84
84
share_neighbour = self .has_neighbour (simplex_points )
85
85
assert share_neighbour , f"The simplex { simplex_points } does not have a common neighbour with all the nodes."
0 commit comments