class_docstr: Suppose n nodes, m >= n-1 edges, d = 2m // n, r = 2m % n
code: def test_hkn_harary_graph(self):
      # When k == 1, the hkn_harary_graph(k,n) is
      # the path_graph(n)
      for k, n in [(1, 6), (1, 7)]:
          G1 = hkn_harary_graph(k, n)
          G2 = nx.path_graph(n)
          assert is_isomorphic(G1, G2)
  
      # When k is even, the hkn_harary_graph(k,n) is
      # the circulant_graph(n, list(range(1,k/2+1)))
      for k, n in [(2, 6), (2, 7), (4, 6), (4, 7)]:
          G1 = hkn_harary_graph(k, n)
          G2 = nx.circulant_graph(n, list(range(1, k // 2 + 1)))
          assert is_isomorphic(G1, G2)
  
      # When k is odd and n is even, the hkn_harary_graph(k,n) is
      # the circulant_graph(n, list(range(1,(k+1)/2)) plus [n/2])
      for k, n in [(3, 6), (5, 8), (7, 10)]:
          G1 = hkn_harary_graph(k, n)
          L = list(range(1, (k + 1) // 2))
          L.append(n // 2)
          G2 = nx.circulant_graph(n, L)
          assert is_isomorphic(G1, G2)
  
      # When k is odd and n is odd, the hkn_harary_graph(k,n) is
      # the circulant_graph(n, list(range(1,(k+1)/2))) with
      # n//2+1 edges added between node i and node i+n//2+1
      for k, n in [(3, 5), (5, 9), (7, 11)]:
          G1 = hkn_harary_graph(k, n)
          G2 = nx.circulant_graph(n, list(range(1, (k + 1) // 2)))
          eSet1 = set(G1.edges)
          eSet2 = set(G2.edges)
          eSet3 = set()
          half = n // 2
          for i in range(half + 1):
              # add half+1 edges between i and i+half
              eSet3.add((i, (i + half) % n))
          assert eSet1 == eSet2 | eSet3
  
      # Raise NetworkXError if k<1
      k = 0
      n = 0
      pytest.raises(nx.NetworkXError, hkn_harary_graph, k, n)
  
      # Raise NetworkXError if n<k+1
      k = 6
      n = 6
      pytest.raises(nx.NetworkXError, hkn_harary_graph, k, n)
  
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 2 for calling the TestHararyGraph obj's underlying member method code with example usage: obj.test_hkn_harary_graph() without return types