diff --git a/modules/data/utils/utils.py b/modules/data/utils/utils.py index e024ab51..93ab5021 100755 --- a/modules/data/utils/utils.py +++ b/modules/data/utils/utils.py @@ -50,16 +50,16 @@ def get_complex_connectivity(complex, max_rank, signed=False): ) except ValueError: # noqa: PERF203 if connectivity_info == "incidence": - connectivity[ - f"{connectivity_info}_{rank_idx}" - ] = generate_zero_sparse_connectivity( - m=practical_shape[rank_idx - 1], n=practical_shape[rank_idx] + connectivity[f"{connectivity_info}_{rank_idx}"] = ( + generate_zero_sparse_connectivity( + m=practical_shape[rank_idx - 1], n=practical_shape[rank_idx] + ) ) else: - connectivity[ - f"{connectivity_info}_{rank_idx}" - ] = generate_zero_sparse_connectivity( - m=practical_shape[rank_idx], n=practical_shape[rank_idx] + connectivity[f"{connectivity_info}_{rank_idx}"] = ( + generate_zero_sparse_connectivity( + m=practical_shape[rank_idx], n=practical_shape[rank_idx] + ) ) connectivity["shape"] = practical_shape return connectivity diff --git a/modules/transforms/feature_liftings/feature_liftings.py b/modules/transforms/feature_liftings/feature_liftings.py index ae8fd287..687f9f1e 100644 --- a/modules/transforms/feature_liftings/feature_liftings.py +++ b/modules/transforms/feature_liftings/feature_liftings.py @@ -28,9 +28,7 @@ def lift_features( ------- torch_geometric.data.Data | dict The lifted data.""" - keys = sorted( - [key.split("_")[1] for key in data.keys() if "incidence" in key] - ) # noqa : SIM118 + keys = sorted([key.split("_")[1] for key in data.keys() if "incidence" in key]) # noqa : SIM118 for elem in keys: if f"x_{elem}" not in data: idx_to_project = 0 if elem == "hyperedges" else int(elem) - 1 diff --git a/modules/transforms/liftings/graph2hypergraph/knn_lifting.py b/modules/transforms/liftings/graph2hypergraph/knn_lifting.py index 7fb003bb..4ee78866 100755 --- a/modules/transforms/liftings/graph2hypergraph/knn_lifting.py +++ b/modules/transforms/liftings/graph2hypergraph/knn_lifting.py @@ -67,9 +67,7 @@ def lift_topology(self, data: torch_geometric.data.Data) -> dict: data_lifted.edge_index[:, idx] = torch.tensor([[i, i]]).T incidence_1[data_lifted.edge_index[1], data_lifted.edge_index[0]] = 1 - incidence_1 = torch.Tensor(incidence_1).to_sparse_coo() - return { "incidence_hyperedges": incidence_1, "num_hyperedges": num_hyperedges, diff --git a/tutorials/graph2hypergraph/knn_lifting.ipynb b/tutorials/graph2hypergraph/knn_lifting.ipynb index 1cd66433..40bf15b9 100644 --- a/tutorials/graph2hypergraph/knn_lifting.ipynb +++ b/tutorials/graph2hypergraph/knn_lifting.ipynb @@ -325,7 +325,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "venv_topox", "language": "python", "name": "python3" }, @@ -339,9 +339,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.11.3" } }, "nbformat": 4, - "nbformat_minor": 4 + "nbformat_minor": 2 } diff --git a/tutorials/graph2simplicial/clique_lifting.ipynb b/tutorials/graph2simplicial/clique_lifting.ipynb index b488ade3..4d551516 100644 --- a/tutorials/graph2simplicial/clique_lifting.ipynb +++ b/tutorials/graph2simplicial/clique_lifting.ipynb @@ -50,19 +50,7 @@ "cell_type": "code", "execution_count": 1, "metadata": {}, - "outputs": [ - { - "ename": "ModuleNotFoundError", - "evalue": "No module named 'modules'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_50472/3754984083.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mget_ipython\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_line_magic\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'load_ext'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'autoreload'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mget_ipython\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_line_magic\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'autoreload'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'2'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mmodules\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloaders\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mGraphLoader\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmodules\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpreprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpreprocessor\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mPreProcessor\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m from modules.utils.utils import (\n", - "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'modules'" - ] - } - ], + "outputs": [], "source": [ "# With this cell any imported module is reloaded before each cell execution\n", "%load_ext autoreload\n", @@ -372,7 +360,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "venv_topox", "language": "python", "name": "python3" }, @@ -386,9 +374,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.11.3" } }, "nbformat": 4, - "nbformat_minor": 4 + "nbformat_minor": 2 }