code: def convert2json(self, convert_dir, out_dir):
      def add_node(id, type, weight, label, feature):
          node_buf = {}
          node_buf["id"] = id
          node_buf["type"] = type
          node_buf["weight"] = weight
          node_buf["features"] = [{}, {}]
          node_buf["features"][0]["name"] = "label"
          node_buf["features"][0]["type"] = "dense"
          node_buf["features"][0]["value"] = label.astype(
              float
          ).tolist()
          node_buf["features"][1]["name"] = "feature"
          node_buf["features"][1]["type"] = "dense"
          feature = feature.astype(float)
          feature /= np.sum(feature) + 1e-7
          node_buf["features"][1]["value"] = feature.tolist()
          return node_buf
  
      def add_edge(src, dst, type, weight):
          edge_buf = {}
          edge_buf["src"] = src
          edge_buf["dst"] = dst
          edge_buf["type"] = type
          edge_buf["weight"] = weight
          edge_buf["features"] = []
          return edge_buf
  
      (
          node_ids,
          node_type,
          node_label,
          node_feature,
          edge_src,
          edge_dst,
          edge_type,
      ) = parse_graph_file(
          convert_dir,
          self.num_classes,
          "Pubmed-Diabetes",
          self.feature_dim + 2,
          self.test_start_num,
      )
  
      with open(out_dir, "w") as out, open(
          self.id_file, "w"
      ) as out_test:
          buf = {}
          buf["nodes"] = []
          buf["edges"] = []
          for one_node, one_type, one_label, one_feature in zip(
              node_ids, node_type, node_label, node_feature
          ):
              buf["nodes"].append(
                  add_node(
                      one_node, one_type, 1, one_label, one_feature
                  )
              )
              if one_type == "test":
                  out_test.write(str(one_node) + "\n")
          for one_src, one_dst, one_type in zip(
              edge_src, edge_dst, edge_type
          ):
              buf["edges"].append(
                  add_edge(one_src, one_dst, one_type, 1)
              )
          out.write(json.dumps(buf))
  
file_path: euler/tf_euler/python/dataset/pubmed.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import json
  import tqdm
  import numpy
  import urllib
  import tarfile
  from tf_euler.python.dataset.pubmed_utils import *
  from tf_euler.python.dataset.base_dataset import DataSet
label_desc: Use image node_id 3 for calling the pubmed obj's underlying member method code with example usage: obj.convert2json(convert_dir, out_dir) and returns: node_buf, edge_buf