code: def to_networkx(cyjs, directed=True):
      
  
      if directed:
          g = nx.MultiDiGraph()
      else:
          g = nx.MultiGraph()
  
      network_data = cyjs[DATA]
      if network_data is not None:
          for key in network_data.keys():
              g.graph[key] = network_data[key]
  
      nodes = cyjs[ELEMENTS][NODES]
      edges = cyjs[ELEMENTS][EDGES]
  
      for node in nodes:
          data = node[DATA]
          g.add_node(data[ID], attr_dict=data)
  
      for edge in edges:
          data = edge[DATA]
          source = data[SOURCE]
          target = data[TARGET]
  
          g.add_edge(source, target, attr_dict=data)
  
      return g
docs: Convert Cytoscape.js-style JSON object into NetworkX object.
  
      By default, data will be handles as a directed graph.