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","."]
code: def _nx_to_json(self, G):
      # Convert G to json:
      G_json = json_graph.node_link_data(G)
      G_json["graph"].update({"id": G.id})
  
      # Convert G_json['nodes'] to strings:
      for n in G_json["nodes"]:
          n["id"] = str(n["id"])
  
      # Fix source and target of G_json['links'] to actual node ids:
      for l in G_json["links"]:
          l["source"] = str(G_json["nodes"][l["source"]]["id"])
          l["target"] = str(G_json["nodes"][l["target"]]["id"])
  
      return G_json
  
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 3 for calling the EPGM obj's underlying member method code with example usage: obj._nx_to_json(G) and returns: G_json