code: def draw_networkx(G, pos=None, arrows=None, with_labels=True, **kwds):
      r"""Draw the graph G using Matplotlib.
  
      Draw the graph with Matplotlib with options for node positions,
      labeling, titles, and many other drawing features.
      See draw() for simple drawing without labels or axes.
  
      Parameters
      ----------
      G : graph
          A networkx graph
  
      pos : dictionary, optional
          A dictionary with nodes as keys and positions as values.
          If not specified a spring layout positioning will be computed.
          See :py:mod:`networkx.drawing.layout` for functions that
          compute node positions.
  
      arrows : bool or None, optional (default=None)
          If `None`, directed graphs draw arrowheads with
          `~matplotlib.patches.FancyArrowPatch`, while undirected graphs draw edges
          via `~matplotlib.collections.LineCollection` for speed.
          If `True`, draw arrowheads with FancyArrowPatches (bendable and stylish).
          If `False`, draw edges using LineCollection (linear and fast).
          For directed graphs, if True draw arrowheads.
          Note: Arrows will be the same color as edges.
  
      arrowstyle : str (default='-\|>' for directed graphs)
          For directed graphs, choose the style of the arrowsheads.
          For undirected graphs default to '-'
  
          See `matplotlib.patches.ArrowStyle` for more options.
  
      arrowsize : int or list (default=10)
          For directed graphs, choose the size of the arrow head's length and
          width. A list of values can be passed in to assign a different size for arrow head's length and width.
          See `matplotlib.patches.FancyArrowPatch` for attribute `mutation_scale`
          for more info.
  
      with_labels :  bool (default=True)
          Set to True to draw labels on the nodes.
  
      ax : Matplotlib Axes object, optional
          Draw the graph in the specified Matplotlib axes.
  
      nodelist : list (default=list(G))
          Draw only specified nodes
  
      edgelist : list (default=list(G.edges()))
          Draw only specified edges
  
      node_size : scalar or array (default=300)
          Size of nodes.  If an array is specified it must be the
          same length as nodelist.
  
      node_color : color or array of colors (default='#1f78b4')
          Node color. Can be a single color or a sequence of colors with the same
          length as nodelist. Color can be string or rgb (or rgba) tuple of
          floats from 0-1. If numeric values are specified they will be
          mapped to colors using the cmap and vmin,vmax parameters. See
          matplotlib.scatter for more details.
  
      node_shape :  string (default='o')
          The shape of the node.  Specification is as matplotlib.scatter
          marker, one of 'so^>v<dph8'.
  
      alpha : float or None (default=None)
          The node and edge transparency
  
      cmap : Matplotlib colormap, optional
          Colormap for mapping intensities of nodes
  
      vmin,vmax : float, optional
          Minimum and maximum for node colormap scaling
  
      linewidths : scalar or sequence (default=1.0)
          Line width of symbol border
  
      width : float or array of floats (default=1.0)
          Line width of edges
  
      edge_color : color or array of colors (default='k')
          Edge color. Can be a single color or a sequence of colors with the same
          length as edgelist. Color can be string or rgb (or rgba) tuple of
          floats from 0-1. If numeric values are specified they will be
          mapped to colors using the edge_cmap and edge_vmin,edge_vmax parameters.
  
      edge_cmap : Matplotlib colormap, optional
          Colormap for mapping intensities of edges
  
      edge_vmin,edge_vmax : floats, optional
          Minimum and maximum for edge colormap scaling
  
      style : string (default=solid line)
          Edge line style e.g.: '-', '--', '-.', ':'
          or words like 'solid' or 'dashed'.
          (See `matplotlib.patches.FancyArrowPatch`: `linestyle`)
  
      labels : dictionary (default=None)
          Node labels in a dictionary of text labels keyed by node
  
      font_size : int (default=12 for nodes, 10 for edges)
          Font size for text labels
  
      font_color : color (default='k' black)
          Font color string. Color can be string or rgb (or rgba) tuple of
          floats from 0-1.
  
      font_weight : string (default='normal')
          Font weight
  
      font_family : string (default='sans-serif')
          Font family
  
      label : string, optional
          Label for graph legend
  
      kwds : optional keywords
          See networkx.draw_networkx_nodes(), networkx.draw_networkx_edges(), and
          networkx.draw_networkx_labels() for a description of optional keywords.
  
      Notes
      -----
      For directed graphs, arrows  are drawn at the head end.  Arrows can be
      turned off with keyword arrows=False.
  
      Examples
      --------
      >>> G = nx.dodecahedral_graph()
      >>> nx.draw(G)
      >>> nx.draw(G, pos=nx.spring_layout(G))  # use spring layout
  
      >>> import matplotlib.pyplot as plt
      >>> limits = plt.axis("off")  # turn off axis
  
      Also see the NetworkX drawing examples at
      https://networkx.org/documentation/latest/auto_examples/index.html
  
      See Also
      --------
      draw
      draw_networkx_nodes
      draw_networkx_edges
      draw_networkx_labels
      draw_networkx_edge_labels
      """
      from inspect import signature
  
      import matplotlib.pyplot as plt
  
      # Get all valid keywords by inspecting the signatures of draw_networkx_nodes,
      # draw_networkx_edges, draw_networkx_labels
  
      valid_node_kwds = signature(draw_networkx_nodes).parameters.keys()
      valid_edge_kwds = signature(draw_networkx_edges).parameters.keys()
      valid_label_kwds = signature(
          draw_networkx_labels
      ).parameters.keys()
  
      # Create a set with all valid keywords across the three functions and
      # remove the arguments of this function (draw_networkx)
      valid_kwds = (
          valid_node_kwds | valid_edge_kwds | valid_label_kwds
      ) - {
          "G",
          "pos",
          "arrows",
          "with_labels",
      }
  
      if any(k not in valid_kwds for k in kwds):
          invalid_args = ", ".join(
              [k for k in kwds if k not in valid_kwds]
          )
          raise ValueError(
              f"Received invalid argument(s): {invalid_args}"
          )
  
      node_kwds = {
          k: v for k, v in kwds.items() if k in valid_node_kwds
      }
      edge_kwds = {
          k: v for k, v in kwds.items() if k in valid_edge_kwds
      }
      label_kwds = {
          k: v for k, v in kwds.items() if k in valid_label_kwds
      }
  
      if pos is None:
          pos = nx.drawing.spring_layout(G)  # default to spring layout
  
      draw_networkx_nodes(G, pos, **node_kwds)
      draw_networkx_edges(G, pos, arrows=arrows, **edge_kwds)
      if with_labels:
          draw_networkx_labels(G, pos, **label_kwds)
      plt.draw_if_interactive()
  
file_path: networkx/networkx/drawing/nx_pylab.py
imports: from numbers import Number
  import networkx
  from networkx.drawing.layout import circular_layout, kamada_kawai_layout, planar_layout, random_layout, shell_layout, spectral_layout, spring_layout
label_desc: Use image node_id 2 for calling a global function with example usage: draw_networkx(G, pos, arrows, with_labels) without return types