code: def _export_graph_to_networkx(
      graph,
      create_using=None,
      vertex_attr_hashable: str = "_nx_name",
  ):
      """Converts the graph to networkx format.
  
      igraph has ordered vertices and edges, but networkx does not. To keep
      track of the original order, the '_igraph_index' vertex property is
      added to both vertices and edges.
  
      @param create_using: specifies which NetworkX graph class to use when
          constructing the graph. C{None} means to let igraph infer the most
          appropriate class based on whether the graph is directed and whether
          it has multi-edges.
      @param vertex_attr_hashable: vertex attribute used to name vertices
          in the exported network. The default "_nx_name" ensures round trip
          conversions to/from networkx are lossless.
      """
      import networkx as nx
  
      # Graph: decide on directness and mutliplicity
      if create_using is None:
          if graph.has_multiple():
              cls = (
                  nx.MultiDiGraph
                  if graph.is_directed()
                  else nx.MultiGraph
              )
          else:
              cls = nx.DiGraph if graph.is_directed() else nx.Graph
      else:
          cls = create_using
  
      # Graph attributes
      kw = {x: graph[x] for x in graph.attributes()}
      g = cls(**kw)
  
      multigraph = isinstance(g, (nx.MultiGraph, nx.MultiDiGraph))
  
      # Nodes and node attributes
      for i, v in enumerate(graph.vs):
          vattr = v.attributes()
          vattr["_igraph_index"] = i
  
          # use _nx_name if the attribute is present so we can achieve
          # a lossless round-trip in terms of vertex names
          if vertex_attr_hashable in vattr:
              hashable = vattr.pop(vertex_attr_hashable)
          else:
              hashable = i
  
          # adding nodes one at a time is not slower in networkx
          g.add_node(hashable, **vattr)
  
      # Edges and edge attributes
      for i, edge in enumerate(graph.es):
          eattr = edge.attributes()
          eattr["_igraph_index"] = i
  
          if multigraph and "_nx_multiedge_key" in eattr:
              eattr["key"] = eattr.pop["_nx_multiedge_key"]
  
          if vertex_attr_hashable in graph.vertex_attributes():
              hashable_source = graph.vs[vertex_attr_hashable][
                  edge.source
              ]
              hashable_target = graph.vs[vertex_attr_hashable][
                  edge.target
              ]
          else:
              hashable_source = edge.source
              hashable_target = edge.target
  
          # adding edges one at a time is not slower in networkx
          g.add_edge(hashable_source, hashable_target, **eattr)
  
      return g
  
label_desc: Use image node_id 1 for calling a global function with example usage: _export_graph_to_networkx(graph, create_using, vertex_attr_hashable) and returns: g