title: python networkx: simple way to get all simple paths from root to leaf
body: <p>I build a tree based on a directed graph. The source data is a series of parent child relationships in an SQL table. It's guaranteed to be a tree (which I verify anyway). 
  I want the set of simple paths from the root to each leaf. The data is headers in an accounting "chart of accounts", and the paths will look like "Root -> Assets -> Current Assets -> Receivables -> Trade Debtors" 
  where 'Trade Debtors' is the actual account. </p>
  
  <p>At the moment, I collect the leaf IDs (the actual accounts) as I build the graph. I can do this because they are identified by certain attributes in the data.
  Then I iterate:</p>
  
  <pre><code>for leaf in detail_or_bank_accts:
      paths_to_detail_or_bank_accts.append(list(nx.all_simple_paths(G,0,leaf)))
  </code></pre>
  
  <p>But lucky for me that I know the leaf nodes. Is there a more elegant way of doing this?</p>