1 import torch
-
F401
'numpy as np' imported but unused
2 import numpy as np
-
F401
'.utils_graph_processing.subgraph_isomorphism_vertex_counts' imported but unused
-
F401
'.utils_graph_processing.subgraph_isomorphism_edge_counts' imported but unused
-
E501
Line too long (104 > 79 characters)
3 from .utils_graph_processing import subgraph_isomorphism_vertex_counts, subgraph_isomorphism_edge_counts
4 from torch_geometric.utils import remove_self_loops
5
6
7 def subgraph_counts2ids(count_fn, data, subgraph_dicts, subgraph_params):
-
W293
Blank line contains whitespace
8
-
E266
Too many leading '#' for block comment
-
E501
Line too long (109 > 79 characters)
9 #### Remove self loops and then assign the structural identifiers by computing subgraph isomorphisms ####
-
W293
Blank line contains whitespace
10
11 if hasattr(data, 'edge_features'):
-
E501
Line too long (90 > 79 characters)
12 edge_index, edge_features = remove_self_loops(data.edge_index, data.edge_features)
13 setattr(data, 'edge_features', edge_features)
14 else:
15 edge_index = remove_self_loops(data.edge_index)[0]
-
W293
Blank line contains whitespace
16
17 num_nodes = data.x.shape[0]
18 identifiers = None
19 for subgraph_dict in subgraph_dicts:
20 kwargs = {'subgraph_dict': subgraph_dict,
21 'induced': subgraph_params['induced'],
22 'num_nodes': num_nodes,
23 'directed': subgraph_params['directed']}
24 counts = count_fn(edge_index, **kwargs)
-
E501
Line too long (91 > 79 characters)
-
E231
Missing whitespace after ','
-
W291
Trailing whitespace
25 identifiers = counts if identifiers is None else torch.cat((identifiers, counts),1)
-
W293
Blank line contains whitespace
26
27 setattr(data, 'edge_index', edge_index)
28 setattr(data, 'identifiers', identifiers.long())
-
W293
Blank line contains whitespace
29
30 return data