code: def waxman_graph(
      n,
      beta=0.4,
      alpha=0.1,
      L=None,
      domain=(0, 0, 1, 1),
      metric=None,
      seed=None,
      *,
      pos_name="pos",
  ):
      r"""Returns a Waxman random graph.
  
      The Waxman random graph model places `n` nodes uniformly at random
      in a rectangular domain. Each pair of nodes at distance `d` is
      joined by an edge with probability
  
      .. math::
              p = \beta \exp(-d / \alpha L).
  
      This function implements both Waxman models, using the `L` keyword
      argument.
  
      * Waxman-1: if `L` is not specified, it is set to be the maximum distance
        between any pair of nodes.
      * Waxman-2: if `L` is specified, the distance between a pair of nodes is
        chosen uniformly at random from the interval `[0, L]`.
  
      Parameters
      ----------
      n : int or iterable
          Number of nodes or iterable of nodes
      beta: float
          Model parameter
      alpha: float
          Model parameter
      L : float, optional
          Maximum distance between nodes.  If not specified, the actual distance
          is calculated.
      domain : four-tuple of numbers, optional
          Domain size, given as a tuple of the form `(x_min, y_min, x_max,
          y_max)`.
      metric : function
          A metric on vectors of numbers (represented as lists or
          tuples). This must be a function that accepts two lists (or
          tuples) as input and yields a number as output. The function
          must also satisfy the four requirements of a `metric`_.
          Specifically, if $d$ is the function and $x$, $y$,
          and $z$ are vectors in the graph, then $d$ must satisfy
  
          1. $d(x, y) \ge 0$,
          2. $d(x, y) = 0$ if and only if $x = y$,
          3. $d(x, y) = d(y, x)$,
          4. $d(x, z) \le d(x, y) + d(y, z)$.
  
          If this argument is not specified, the Euclidean distance metric is
          used.
  
          .. _metric: https://en.wikipedia.org/wiki/Metric_%28mathematics%29
  
      seed : integer, random_state, or None (default)
          Indicator of random number generation state.
          See :ref:`Randomness<randomness>`.
      pos_name : string, default="pos"
          The name of the node attribute which represents the position
          in 2D coordinates of the node in the returned graph.
  
      Returns
      -------
      Graph
          A random Waxman graph, undirected and without self-loops. Each
          node has a node attribute ``'pos'`` that stores the position of
          that node in Euclidean space as generated by this function.
  
      Examples
      --------
      Specify an alternate distance metric using the ``metric`` keyword
      argument. For example, to use the "`taxicab metric`_" instead of the
      default `Euclidean metric`_::
  
          >>> dist = lambda x, y: sum(abs(a - b) for a, b in zip(x, y))
          >>> G = nx.waxman_graph(10, 0.5, 0.1, metric=dist)
  
      .. _taxicab metric: https://en.wikipedia.org/wiki/Taxicab_geometry
      .. _Euclidean metric: https://en.wikipedia.org/wiki/Euclidean_distance
  
      Notes
      -----
      Starting in NetworkX 2.0 the parameters alpha and beta align with their
      usual roles in the probability distribution. In earlier versions their
      positions in the expression were reversed. Their position in the calling
      sequence reversed as well to minimize backward incompatibility.
  
      References
      ----------
      .. [1]  B. M. Waxman, *Routing of multipoint connections*.
         IEEE J. Select. Areas Commun. 6(9),(1988) 1617--1622.
      """
      G = nx.empty_graph(n)
      (xmin, ymin, xmax, ymax) = domain
      # Each node gets a uniformly random position in the given rectangle.
      pos = {
          v: (seed.uniform(xmin, xmax), seed.uniform(ymin, ymax))
          for v in G
      }
      nx.set_node_attributes(G, pos, pos_name)
      # If no distance metric is provided, use Euclidean distance.
      if metric is None:
          metric = math.dist
      # If the maximum distance L is not specified (that is, we are in the
      # Waxman-1 model), then find the maximum distance between any pair
      # of nodes.
      #
      # In the Waxman-1 model, join nodes randomly based on distance. In
      # the Waxman-2 model, join randomly based on random l.
      if L is None:
          L = max(
              metric(x, y) for x, y in combinations(pos.values(), 2)
          )
  
          def dist(u, v):
              return metric(pos[u], pos[v])
  
      else:
  
          def dist(u, v):
              return seed.random() * L
  
      # `pair` is the pair of nodes to decide whether to join.
      def should_join(pair):
          return seed.random() < beta * math.exp(
              -dist(*pair) / (alpha * L)
          )
  
      G.add_edges_from(filter(should_join, combinations(G, 2)))
      return G
  
file_path: networkx/networkx/generators/geometric.py
imports: import math
  from bisect import bisect_left
  from itertools import accumulate, combinations, product
  import networkx
  from networkx.utils import py_random_state
label_desc: Use image node_id 6 for calling a global function with example usage: waxman_graph(n, beta, alpha, L, domain, metric, seed) and returns: G, unknown, metric, unknown