code: def test_preferential_attachment(self):
      aseq = [3, 2, 1, 1]
      G = preferential_attachment_graph(aseq, 0.5)
      assert G.is_multigraph()
      assert not G.is_directed()
  
      G = preferential_attachment_graph(
          aseq, 0.5, create_using=nx.Graph
      )
      assert not G.is_multigraph()
      assert not G.is_directed()
  
      pytest.raises(
          nx.NetworkXError,
          preferential_attachment_graph,
          aseq,
          0.5,
          create_using=nx.DiGraph(),
      )
      pytest.raises(
          nx.NetworkXError,
          preferential_attachment_graph,
          aseq,
          0.5,
          create_using=nx.DiGraph(),
      )
      pytest.raises(
          nx.NetworkXError,
          preferential_attachment_graph,
          aseq,
          0.5,
          create_using=nx.DiGraph(),
      )
  
file_path: networkx/networkx/algorithms/bipartite/tests/test_generators.py
imports: import numbers
  import pytest
  import networkx
  from ..generators import alternating_havel_hakimi_graph, complete_bipartite_graph, configuration_model, gnmk_random_graph, havel_hakimi_graph, preferential_attachment_graph, random_graph, reverse_havel_hakimi_graph
label_desc: Use image node_id 6 for calling the TestGeneratorsBipartite obj's underlying member method code with example usage: obj.test_preferential_attachment() without return types