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: Update self.G by adding a new graph G_json_add
docstr_tok: ["Update","self.G","by","adding","a","new","graph","G_json_add"]
code: def append(self, G_add):
      """Update self.G by adding a new graph G_json_add"""
      G_json_add = self._nx_to_json(G_add)
      if any(
          [
              G_json_add["graph"]["id"] in g["id"]
              for g in self.G["graphs"]
          ]
      ):
          raise Exception(
              "Graph with id {} already exists".format(
                  G_json_add["graph"]["id"]
              )
          )
  
      # update self.G['graphs']:
      G_epgm_add = self._json_to_epgm(
          G_json_add, None, None
      )  # was None, None, None
      self.G["graphs"].append(G_epgm_add["graphs"][0])
  
      # update self.G['vertices']:
      G_vertices = set([v["id"] for v in self.G["vertices"]])
      G_add_vertices = set([v["id"] for v in G_epgm_add["vertices"]])
      common_vertices = list(G_vertices.intersection(G_add_vertices))
      new_vertices = list(G_add_vertices.difference(G_vertices))
  
      # update common vertices in self.G and G_epgm_add:
      for v_id in common_vertices:
          i = [v["id"] == v_id for v in self.G["vertices"]].index(
              True
          )  # find the vertex index in self.G
          self.G["vertices"][i]["meta"]["graphs"].append(
              G_epgm_add["graphs"][0]["id"]
          )
  
      # append new vertices to self.G['vertices']:
      for v_id in new_vertices:
          i = [v["id"] == v_id for v in G_epgm_add["vertices"]].index(
              True
          )  # find the index of v_id in G_epgm_add['vertices']
          self.G["vertices"].append(
              G_epgm_add["vertices"][i]
          )  # add the vertex v_id to self.G['vertices']
  
      # update self.G['edges']:
      G_edges = set(
          [(e["source"], e["target"]) for e in self.G["edges"]]
      )
      G_add_edges = set(
          [(e["source"], e["target"]) for e in G_epgm_add["edges"]]
      )
      common_edges = list(G_edges.intersection(G_add_edges))
      new_edges = list(G_add_edges.difference(G_edges))
  
      # update common edges in self.G and G_epgm_add:
      for e_id in common_edges:
          i = [
              (e["source"], e["target"]) == e_id
              for e in self.G["edges"]
          ].index(
              True
          )  # find the edge index in self.G
          self.G["edges"][i]["meta"]["graphs"].append(
              G_epgm_add["graphs"][0]["id"]
          )
  
      # append new edges to self.G['edges']:
      for e_id in new_edges:
          i = [
              (e["source"], e["target"]) == e_id
              for e in G_epgm_add["edges"]
          ].index(
              True
          )  # find the index of e_id in G_epgm_add['edges']
          self.G["edges"].append(G_epgm_add["edges"][i])
  
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 11 for calling the EPGM obj's underlying member method code with example usage: obj.append(G_add) without return types