title: Combine (join) networkx Graphs
body: <p>Say I have two networkx graphs, <code>G</code> and <code>H</code>:</p>
  <pre><code>G=nx.Graph()
  fromnodes=[0,1,1,1,1,1,2]
  tonodes=[1,2,3,4,5,6,7]
  for x,y in zip(fromnodes,tonodes):
      G.add_edge(x,y)
  
  H=nx.Graph()
  fromnodes=range(2,8)
  tonodes=range(8,14)
  for x,y in zip(fromnodes,tonodes):
      H.add_edge(x,y)
  </code></pre>
  <p><strong>What is the best way to join the two networkx graphs?</strong></p>
  <p>I'd like to preserve the node names (note the common nodes, 2 to 7). When I used <code>nx.disjoint_union(G,H)</code>, this did not happen:</p>
  <pre><code>&gt;&gt;&gt; G.nodes()
  [0, 1, 2, 3, 4, 5, 6, 7]
  &gt;&gt;&gt; H.nodes()
  [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
  &gt;&gt;&gt; Un= nx.disjoint_union(G,H)
  &gt;&gt;&gt; Un.nodes()
  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
  # 
  </code></pre>
  <p>The <code>H</code> node labels were changed (not what I want). I want to join the graphs at the nodes with the same number.</p>
  <p><em>Note. This is not a duplicate of <a href="https://stackoverflow.com/questions/21806751/combine-two-weighted-graphs-in-networkx.">Combine two weighted graphs in NetworkX</a></em></p>