code: def insert_graph(cur, nodelist, edgelist, encoded_data=None):
      if encoded_data is None:
          encoded_data = {}
      if 'num_nodes' not in encoded_data:
          encoded_data['num_nodes'] = len(nodelist)
      if 'num_edges' not in encoded_data:
          encoded_data['num_edges'] = len(edgelist)
      if 'edges' not in encoded_data:
          encoded_data['edges'] = json.dumps(edgelist, separators=(',', ':'))
      insert = \
      cur.execute(insert, encoded_data)