class_docstr: EPGM class with converter methods to edgelist, adjacency matrix, etc.
class_docstr_tok: ["EPGM","class","with","converter","methods","to","edgelist",",","adjacency","matrix",",","etc","."]
docstr: Write self.G into three json files: graphs.json, vertices.json, and edges.json, in path directory
docstr_tok: ["Write","self.G","into","three","json","files",":","graphs.json",",","vertices.json",",","and","edges.json",",","in","path","directory"]
code: def save(self, path):
      """
      Write self.G into three json files: graphs.json, vertices.json, and edges.json, in path directory
      """
      self.path = path
      if not os.path.isdir(self.path):
          os.makedirs(self.path)
  
      for k in self.G.keys():
          with open(
              os.path.join(self.path, str(k) + ".json"), "w"
          ) as fp:
              if isinstance(self.G[k], list):
                  for l in self.G[k]:
                      json.dump(l, fp)
                      fp.write("\n")
              elif isinstance(self.G[k], OrderedDict) or isinstance(
                  self.G[k], dict
              ):
                  json.dump(self.G[k], fp)
              else:
                  print(
                      "type(G[",
                      k,
                      "]): unexpected type",
                      type(self.G[k]).__name__,
                      ", stopping.",
                  )
                  raise ()
  
imports: from collections import OrderedDict
  import networkx
  from networkx.readwrite import json_graph
  import os
  import json
  import uuid
  import numpy
  import scipy.sparse
  import multiprocessing
  from multiprocessing import Pool
  from functools import partial
  from time import sleep
label_desc: Use image node_id 16 for calling the EPGM obj's underlying member method code with example usage: obj.save(path) without return types