title: Is there a functin in "Networkx" for getting a connected subgraph giving any number of nodes
body: <p>I have a graph that containing 100 nodes.
  Now, I want to know is there any function can get a subgraph when I giving a number of nodes, and that subgraph returned should <strong>connected</strong>.
  I have try to used <code>G.subgraph</code> function, it works when the nodes I gaven are connected in Graph, but while the nodes I gaven aren't connected, <code>G.subgraph</code> will return more than one component to me.
  For example, I have a Graph like below:</p>
  <p><a href="https://i.stack.imgur.com/5FvPC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5FvPC.png" alt="enter image description here" /></a></p>
  <p>Giving <strong>[A,B,G,I]</strong> nodes:
  <a href="https://i.stack.imgur.com/TKw7g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TKw7g.png" alt="enter image description here" /></a></p>
  <p>The function that I want should return a subgraph that containing <strong>[A,B,G,E,I]</strong>, rather than <strong>[A,B,G]</strong> and <strong>[I]</strong></p>
  <p>Bad English, I hope you can understand my expression.</p>
  <p><strong>Thank you very much for helping me.</strong></p>
  <p><strong>Thank you very much for helping me.</strong></p>
  <p><strong>Thank you very much for helping me.</strong></p>