title: how to fix the __delitem__ method
body: <pre><code>{'a': [{'c','d'},  {'d'}        ],
  'b': [{'c','d'},  set()        ],
  'c': [set(),      {'a','b','d'}],
  'd': [{'a','c'},  {'a','b'}    ],
  'e': [set(),      set()        ]}
  
  
  class Graph:
      def __init__(self,*args):
          self.edges = {} 
  
      def __delitem__(self,item):
          if type(item) == tuple:
              for key,value in self.edges.items():
                  if key == item[0] and item[1] in value[0]:
                      self.edges[item[0]].remove(item(1))
          elif item in self.edges.keys():
              del self.edges[item]
              for value in self.edges.values():
                  if item in value:
                      value.remove(item)
          raise GraphError
  </code></pre>
  
  <p>the delitem takes a tuple or a str:</p>
  
  <p>If the item parameter is a 2-tuple specifying an origin node and a destination node that are both are in the Graph, delete that edge from the Graph. If the edge is present, update the sets for both the origin node and destination node to reflect that the edge has been deleted.</p>
  
  <p>for example:
  calling del g['a','e'] will do nothing, but calling del g['a','c'] will change the graph to:</p>
  
  <pre><code> {'a': [{'d'},      {'d'}    ],
    'b': [{'c','d'},  set()    ],
    'c': [set(),      {'b','d'}],
    'd': [{'a','c'},  {'a','b'}],
    'e': [set(),      set()    ]}
  </code></pre>
  
  <p>If the item parameter is a key node in the Graph
  First delete that node from every set in which it is an origin node or a destination node.
  Second delete that node as a key from the edges dict.</p>
  
  <p>calling del g['x'] would do nothing (there is no node x),but calling del g['a'] will change the graph to:</p>
  
  <pre><code>{'b': [{'c','d'},  set()    ],
  'c': [set(),      {'b','d'}],
  'd': [{'c'},      {'b'}    ],
  'e': [set(),      set()    ]}
  </code></pre>
  
  <p>but when I run my delitem function, it produces the following error:</p>
  
  <pre><code>119 # Test __delitem__
  122 *Error: del g['a','c'] raised exception TypeError: 'tuple' object is not callable
  123 *Error: Failed g.edges == {'a': [{'d'},{'d'}], 'b': [{'c','d'}, set()], 'c': [set(),{'b','d'}], 'd': [{'a','c'},{'a','b'}], 'e': [set(),set()]}
        evaluated: {'b': [{'c', 'd'}, set()], 'e': [set(), set()], 'c': [set(), {'b', 'a', 'd'}], 'a': [{'c', 'd'}, {'d'}], 'd': [{'c', 'a'}, {'b', 'a'}]} == {'b': [{'c', 'd'}, set()], 'e': [set(), set()], 'c': [set(), {'b', 'd'}], 'a': [{'d'}, {'d'}], 'd': [{'c', 'a'}, {'b', 'a'}]}
  124 *Error: del g['b','d'] raised exception TypeError: 'tuple' object is not callable
  125 *Error: Failed g.edges == {'a': [{'d'},{'d'}], 'b': [{'c'}, set()], 'c': [set(),{'b','d'}], 'd': [{'a','c'},{'a'}], 'e': [set(),set()]}
        evaluated: {'b': [{'c', 'd'}, set()], 'e': [set(), set()], 'c': [set(), {'b', 'a', 'd'}], 'a': [{'c', 'd'}, {'d'}], 'd': [{'c', 'a'}, {'b', 'a'}]} == {'b': [{'c'}, set()], 'e': [set(), set()], 'c': [set(), {'b', 'd'}], 'a': [{'d'}, {'d'}], 'd': [{'c', 'a'}, {'a'}]}
  127 *Error: del g['c'] raised exception graph.GraphError: 
  128 *Error: Failed g.edges == {'a': [{'d'},{'d'}], 'b': [{'d'}, set()], 'd': [{'a'},{'a','b'}], 'e': [set(),set()]}
        evaluated: {'b': [{'c', 'd'}, set()], 'e': [set(), set()], 'a': [{'c', 'd'}, {'d'}], 'd': [{'c', 'a'}, {'b', 'a'}]} == {'b': [{'d'}, set()], 'e': [set(), set()], 'a': [{'d'}, {'d'}], 'd': [{'a'}, {'b', 'a'}]}
  129 *Error: del g['a'] raised exception graph.GraphError: 
  130 *Error: Failed g.edges == {'b': [{'d'}, set()], 'd': [set(),{'b'}], 'e': [set(),set()]}
        evaluated: {'b': [{'c', 'd'}, set()], 'e': [set(), set()], 'd': [{'c', 'a'}, {'b', 'a'}]} == {'b': [{'d'}, set()], 'e': [set(), set()], 'd': [set(), {'b'}]}
  </code></pre>
  
  <p>I am not sure what is wrong, can someone help me to fix my delitem function? Many thanks.</p>