code: def convert2json(self, convert_dir, out_dir):
      prefix = os.path.join(convert_dir, "reddit")
      G, feats, id_map, walks, class_map = load_data(prefix)
      out_test = open(self.id_file, "w")
      with open(out_dir, "w") as out:
          buf = {}
          buf["nodes"] = []
          buf["edges"] = []
          for node_id in tqdm.tqdm(G.nodes()):
              node_buf = {}
              idx = id_map[node_id]
              node_buf["id"] = idx
              node_buf["type"] = get_node_type(G.node[node_id])
              if node_buf["type"] == "test":
                  out_test.write(str(idx) + "\n")
              node_buf["weight"] = len(G[node_id])
              node_buf["features"] = [{}, {}]
              node_buf["features"][0]["name"] = "label"
              node_buf["features"][0]["type"] = "dense"
              node_buf["features"][0]["value"] = [class_map[node_id]]
              node_buf["features"][1]["name"] = "feature"
              node_buf["features"][1]["type"] = "dense"
              node_buf["features"][1]["value"] = list(feats[idx])
              buf["nodes"].append(node_buf)
              for dst_id in G[node_id]:
                  ebuf = {
                      "src": idx,
                      "dst": id_map[dst_id],
                      "type": get_edge_type(G[node_id][dst_id]),
                      "weight": 1,
                      "features": [],
                  }
                  buf["edges"].append(ebuf)
          out.write(json.dumps(buf))
      out_test.close()
  
file_path: euler/tf_euler/python/dataset/reddit.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import json
  import urllib
  import zipfile
  import tqdm
  from tf_euler.python.dataset.sage_util import *
  from tf_euler.python.dataset.base_dataset import DataSet
label_desc: Use image node_id 3 for calling the reddit obj's underlying member method code with example usage: obj.convert2json(convert_dir, out_dir) without return types