class_docstr: Unit tests for :func:`~networkx.thresholded_random_geometric_graph`
class_docstr_tok: ["Unit","tests","for",":","func",":","`","~networkx.thresholded_random_geometric_graph","`"]
docstr: Tests for providing an alternate distance metric to the generator.
docstr_tok: ["Tests","for","providing","an","alternate","distance","metric","to","the","generator","."]
code: def test_p(self):
      """Tests for providing an alternate distance metric to the generator."""
  
      # Use the L1 metric.
      def dist(x, y):
          return sum(abs(a - b) for a, b in zip(x, y))
  
      G = nx.thresholded_random_geometric_graph(
          50, 0.25, 0.1, p=1, seed=42
      )
      for u, v in combinations(G, 2):
          # Adjacent vertices must be within the given distance.
          if v in G[u]:
              assert dist(G.nodes[u]["pos"], G.nodes[v]["pos"]) <= 0.25
  
imports: import math
  import random
  from itertools import combinations
  import pytest
  import networkx
label_desc: Use image node_id 3 for calling the TestThresholdedRandomGeometricGraph obj's underlying member method code with example usage: obj.test_p() and returns: sum