MCPcopy Create free account
hub / github.com/alibaba/euler / convert2json

Method convert2json

tf_euler/python/dataset/mutag.py:80–93  ·  view source on GitHub ↗
(self, convert_dir, out_dir)

Source from the content-addressed store, hash-verified

78 mutag_zip.extractall(out_dir)
79
80 def convert2json(self, convert_dir, out_dir):
81 prefix = os.path.join(self.data_dir, 'MUTAG_')
82 adj_list = read_adj(prefix + 'A.txt')
83 graph_indicator = read_graph_indicator(prefix + 'graph_indicator.txt')
84 graph_label = read_graph_label(prefix + 'graph_labels.txt')
85 node_label = read_node_label(prefix + 'node_labels.txt')
86 self.generate_index_meta()
87 with open(out_dir, 'w') as out:
88 out.write(gen_graph_json(adj_list, graph_indicator,
89 graph_label, node_label))
90 with open(self.id_file, 'w') as id_out:
91 start_idx = int(self.total_size * self.train_rate)
92 for i in range(start_idx, self.total_size):
93 id_out.write(str(i) + '\n')

Callers

nothing calls this directly

Calls 7

generate_index_metaMethod · 0.95
read_adjFunction · 0.85
read_graph_indicatorFunction · 0.85
read_graph_labelFunction · 0.85
read_node_labelFunction · 0.85
gen_graph_jsonFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected