docstr: Betweenness centrality: P3 sample
docstr_tok: ["Betweenness","centrality",":","P3","sample"]
code: def test_sample_from_P3(self):
      """Betweenness centrality: P3 sample"""
      G = nx.path_graph(3)
      b_answer = {0: 0.0, 1: 1.0, 2: 0.0}
      b = nx.betweenness_centrality(
          G, k=3, weight=None, normalized=False, seed=1
      )
      for n in sorted(G):
          assert b[n] == pytest.approx(b_answer[n], abs=1e-7)
      b = nx.betweenness_centrality(
          G, k=2, weight=None, normalized=False, seed=1
      )
      # python versions give different results with same seed
      b_approx1 = {0: 0.0, 1: 1.5, 2: 0.0}
      b_approx2 = {0: 0.0, 1: 0.75, 2: 0.0}
      for n in sorted(G):
          assert b[n] in (b_approx1[n], b_approx2[n])
  
imports: import pytest
  import networkx
label_desc: Use image node_id 5 for calling the TestBetweennessCentrality obj's underlying member method code with example usage: obj.test_sample_from_P3() without return types