title: NetworkXError: Node 8 has no position
body: <p>I just started programming and recently I'm working in ipython notebook with networkx. This code below is working perfectly if you run it, but if you uncomment #G.add_edge(2, 8, egdes=6) it gives you the error NetworkXError: Node 8 has no position. Why does it only work until the sixth node?</p>
  
  <pre><code>import networkx as nx 
  import matplotlib.pyplot as plt
  import pylab
  %matplotlib inline
  
  pos=nx.spring_layout(G)
  
  G = nx.Graph()
  
  G.add_edge(1, 2, egdes=1)
  G.add_edge(1, 3, egdes=2)
  G.add_edge(1, 4, egdes=3)
  G.add_edge(1, 5, egdes=4)
  G.add_edge(1, 6, egdes=5)
  #G.add_edge(2, 8, egdes=6)
  
  nx.draw(G,pos)
  edge_labels=dict([((fe,se,),e['egdes'])
              for fe,se,e in G.edges(data=True)])
  
  nx.draw_networkx_edge_labels(G,pos,edge_labels)
  
  pylab.show()
  </code></pre>
  
  <p>I hope one of you guys can help me, thanks in advance!</p>