class_docstr: Read a GraphML document.  Produces NetworkX graph objects.
class_docstr_tok: ["Read","a","GraphML","document",".","Produces","NetworkX","graph","objects","."]
code: def make_graph(self, graph_xml, graphml_keys, defaults, G=None):
      # set default graph type
      edgedefault = graph_xml.get("edgedefault", None)
      if G is None:
          if edgedefault == "directed":
              G = nx.MultiDiGraph()
          else:
              G = nx.MultiGraph()
      # set defaults for graph attributes
      G.graph["node_default"] = {}
      G.graph["edge_default"] = {}
      for key_id, value in defaults.items():
          key_for = graphml_keys[key_id]["for"]
          name = graphml_keys[key_id]["name"]
          python_type = graphml_keys[key_id]["type"]
          if key_for == "node":
              G.graph["node_default"].update({name: python_type(value)})
          if key_for == "edge":
              G.graph["edge_default"].update({name: python_type(value)})
      # hyperedges are not supported
      hyperedge = graph_xml.find(f"{{{self.NS_GRAPHML}}}hyperedge")
      if hyperedge is not None:
          raise nx.NetworkXError(
              "GraphML reader doesn't support hyperedges"
          )
      # add nodes
      for node_xml in graph_xml.findall(f"{{{self.NS_GRAPHML}}}node"):
          self.add_node(G, node_xml, graphml_keys, defaults)
      # add edges
      for edge_xml in graph_xml.findall(f"{{{self.NS_GRAPHML}}}edge"):
          self.add_edge(G, edge_xml, graphml_keys)
      # add graph data
      data = self.decode_data_elements(graphml_keys, graph_xml)
      G.graph.update(data)
  
      # switch to Graph or DiGraph if no parallel edges were found
      if self.multigraph:
          return G
  
      G = nx.DiGraph(G) if G.is_directed() else nx.Graph(G)
      # add explicit edge "id" from file as attribute in NX graph.
      nx.set_edge_attributes(G, values=self.edge_ids, name="id")
      return G
  
imports: import warnings
  from collections import defaultdict
  import networkx
  from networkx.utils import open_file
label_desc: Use image node_id 3 for calling the GraphMLReader obj's underlying member method code with example usage: obj.make_graph(graph_xml, graphml_keys, defaults, G) and returns: G, G