class_docstr: Suppose n nodes, m >= n-1 edges, d = 2m // n, r = 2m % n
code: def test_hnm_harary_graph(self):
      # When d is even and r = 0, the hnm_harary_graph(n,m) is
      # the circulant_graph(n, list(range(1,d/2+1)))
      for n, m in [(5, 5), (6, 12), (7, 14)]:
          G1 = hnm_harary_graph(n, m)
          d = 2 * m // n
          G2 = nx.circulant_graph(n, list(range(1, d // 2 + 1)))
          assert is_isomorphic(G1, G2)
  
      # When d is even and r > 0, the hnm_harary_graph(n,m) is
      # the circulant_graph(n, list(range(1,d/2+1)))
      # with r edges added arbitrarily
      for n, m in [(5, 7), (6, 13), (7, 16)]:
          G1 = hnm_harary_graph(n, m)
          d = 2 * m // n
          G2 = nx.circulant_graph(n, list(range(1, d // 2 + 1)))
          assert set(G2.edges) < set(G1.edges)
          assert G1.number_of_edges() == m
  
      # When d is odd and n is even and r = 0, the hnm_harary_graph(n,m)
      # is the circulant_graph(n, list(range(1,(d+1)/2) plus [n//2])
      for n, m in [(6, 9), (8, 12), (10, 15)]:
          G1 = hnm_harary_graph(n, m)
          d = 2 * m // n
          L = list(range(1, (d + 1) // 2))
          L.append(n // 2)
          G2 = nx.circulant_graph(n, L)
          assert is_isomorphic(G1, G2)
  
      # When d is odd and n is even and r > 0, the hnm_harary_graph(n,m)
      # is the circulant_graph(n, list(range(1,(d+1)/2) plus [n//2])
      # with r edges added arbitrarily
      for n, m in [(6, 10), (8, 13), (10, 17)]:
          G1 = hnm_harary_graph(n, m)
          d = 2 * m // n
          L = list(range(1, (d + 1) // 2))
          L.append(n // 2)
          G2 = nx.circulant_graph(n, L)
          assert set(G2.edges) < set(G1.edges)
          assert G1.number_of_edges() == m
  
      # When d is odd and n is odd, the hnm_harary_graph(n,m) is
      # the circulant_graph(n, list(range(1,(d+1)/2))
      # with m - n*(d-1)/2 edges added arbitrarily
      for n, m in [(5, 4), (7, 12), (9, 14)]:
          G1 = hnm_harary_graph(n, m)
          d = 2 * m // n
          L = list(range(1, (d + 1) // 2))
          G2 = nx.circulant_graph(n, L)
          assert set(G2.edges) < set(G1.edges)
          assert G1.number_of_edges() == m
  
      # Raise NetworkXError if n<1
      n = 0
      m = 0
      pytest.raises(nx.NetworkXError, hnm_harary_graph, n, m)
  
      # Raise NetworkXError if m < n-1
      n = 6
      m = 4
      pytest.raises(nx.NetworkXError, hnm_harary_graph, n, m)
  
      # Raise NetworkXError if m > n(n-1)/2
      n = 6
      m = 16
      pytest.raises(nx.NetworkXError, hnm_harary_graph, n, m)
  
imports: import pytest
  import networkx
  from networkx.algorithms.isomorphism.isomorph import is_isomorphic
  from networkx.generators.harary_graph import hkn_harary_graph, hnm_harary_graph
label_desc: Use image node_id 1 for calling the TestHararyGraph obj's underlying member method code with example usage: obj.test_hnm_harary_graph() without return types