title: G.add_edge error in Networkx as key error
body: <p>I tried to add edges from a list:</p>
  
  <pre><code>for first in G.nodes():
      G_dict = copy.copy(G.node[first])
      sorted_G = sorted(G_dict.iteritems(), key = op.itemgetter(1), reverse = True)
          for number in range(0, close_limit):
             edge_temp.append((first,sorted_G[number][0]))
             print(edge_temp)
             G.add_edges_from(edge_temp)
  </code></pre>
  
  <p>When I printed the edge_temp, it worked very well. However, when I tried to use the function <code>G.add_edges_from()</code>, the error was:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Python27\Wireless\rd_pc_contact1.py", line 95, in &lt;module&gt;
      G.add_edges_from(edge_temp)
       File "C:\Python27\lib\site-packages\networkx-  
       1.8.1py2.7.egg\networkx\classes\graph.py", line 785, in add_edges_from
       datadict=self.adj[u].get(v,{})
    KeyError: 0
  </code></pre>
  
  <p>I can not understand the reason why error occurred. Could you clearly explain the error?</p>