docstr: core number had a bug for directed graphs found in issue #1959
docstr_tok: ["core","number","had","a","bug","for","directed","graphs","found","in","issue","#","1959"]
code: def test_directed_core_number(self):
      """core number had a bug for directed graphs found in issue #1959"""
      # small example where too timid edge removal can make cn[2] = 3
      G = nx.DiGraph()
      edges = [(1, 2), (2, 1), (2, 3), (2, 4), (3, 4), (4, 3)]
      G.add_edges_from(edges)
      assert nx.core_number(G) == {1: 2, 2: 2, 3: 2, 4: 2}
      # small example where too aggressive edge removal can make cn[2] = 2
      more_edges = [(1, 5), (3, 5), (4, 5), (3, 6), (4, 6), (5, 6)]
      G.add_edges_from(more_edges)
      assert nx.core_number(G) == {1: 3, 2: 3, 3: 3, 4: 3, 5: 3, 6: 3}
  
imports: import pytest
  import networkx
  from networkx.utils import nodes_equal
label_desc: Use image node_id 7 for calling the TestCore obj's underlying member method code with example usage: obj.test_directed_core_number() without return types