title: How to check whether two nodes are connected?
body: <p>I have a NetworkX graph with four nodes <code>(a,b,c,d)</code> which are partially connected. How can I check whether two nodes are adjacent? For example: How could I assert that <code>a</code> and <code>d</code> are not adjacent?</p>
  
  <pre><code>import networkx as nx
  G=nx.Graph()
  G.add_edge('a','b',weight=1)
  G.add_edge('a','c',weight=1)
  G.add_edge('c','d',weight=1)
  </code></pre>
  
  <p>I tried the following, but failed:</p>
  
  <pre><code>nx.is_connected(G) # I assume it checks whether edges are connected at all
  nx.connected_components(G) # outputs an object that I can make no use of
  </code></pre>