title: Adding an edge by node attribute between two nodes in Python Networkx
body: <p>I'm writing some python code to create an edge between two nodes, and then randomly remove 2 edges from one of those nodes but with other nodes (not the original two).</p>
  
  <p>Right now I'm stuck (and have gone over all networkx documentation multiple times).</p>
  
  <p>I called/named one of the nodes "bad_apple_Bad_apple" - the other one I captured by it being the most central node in "self.most_central_node" using a max function to identify it. I can't seem to be able to select the node object itself so that I can create the edge using add_edge().</p>
  
  <p>I'm pretty sure I'll need to explain more, but below is the code. I can post more of the code if need be, but I tried to go a little further up the code file to give some background on what I'm doing.</p>
  
  <pre><code>    self.most_central_node = max(nx.closeness_centrality(self.combined_network))
      print("The node with the max value for closeness centrality in the combined network is: ", self.most_central_node)
  
      self.bad_apple_node_stuff = self.combined_network['bad_apple_Bad_apple']
  
      print("This is the bad apple test", self.bad_apple_node_stuff) #This is not printing the node object which means I'm not selecting it. It's printing it's attributes, I think. This is where the issue is.
  
      self.combined_network.add_edge(self.combined_network.node['bad_apple_Bad_apple'], self.combined_network.node['closeness'==self.most_central_node]) #&lt;&lt;-- this doesnt work, no specific error though
  </code></pre>