def __getitem__(self, idx): G = self.graph_list[idx] # Get DFS code matrix min_dfscode = get_min_dfscode(G, self.temp_path) print(min_dfscode) # dfscode tensors dfscode_tensors = dfscode_to_tensor(min_dfscode, self.feature_map) return dfscode_tensors
def graph_to_min_dfscode(graph_file, graphs_path, min_dfscodes_path, temp_path): with open(graphs_path + graph_file, 'rb') as f: G = pickle.load(f) min_dfscode = get_min_dfscode(G, temp_path) if len(G.edges()) == len(min_dfscode): with open(min_dfscodes_path + graph_file, 'wb') as f: pickle.dump(min_dfscode, f) else: print('Error in min dfscode for filename', graph_file) exit()