title: Python networkx iterating through list of subgraphs
body: <p>I am having a bit of trouble obtaining an iteration through all possible subragphs of a large nx graph G, taken as input from a text file.</p>
  
  <p>The following is some code I found on StackOverflow, but is not yielding what i am looking for:</p>
  
  <pre><code>    g = read_graph(sys.argv[1])
  
      print ('Number of subgraphs:', len(g.subgraph(g.nodes())))
  
      # extract subgraphs
      sub_graphs = nx.connected_component_subgraphs(g)
  
      for i, sg in enumerate(sub_graphs):
          print "subgraph {} has {} nodes".format(i, sg.number_of_nodes())
          print "\tNodes:", sg.nodes(data=True)
          print "\tEdges:", sg.edges() 
  </code></pre>
  
  <p>Prints out:</p>
  
  <pre><code>('Number of subgraphs:', 4039)
  subgraph 0 has 4039 nodes
      Nodes: &lt;generator object nodes at 0x10ed77910&gt;
      Edges: &lt;generator object edges at 0x10ed77910&gt;
  </code></pre>
  
  <p>What I am trying to do is be able to iterate through all possible subgraphs of length 3 or greater, then perform certain functions on them as graphs.</p>
  
  <p>Thanks!</p>