title: Using networkX to output a tree structure
body: <p>I am using networkX to generate a tree structure as follows (I am following the <a href="https://stackoverflow.com/questions/11479624/is-there-a-way-to-guarantee-hierarchical-output-from-networkx">answer of this question</a>).</p>
  
  <pre><code>import networkx as nx
  import matplotlib.pyplot as plt
  G = nx.DiGraph()
  
  G.add_node("ROOT")
  for i in range(5):
      G.add_node("Child_%i" % i)
      G.add_node("Grandchild_%i" % i)
      G.add_node("Greatgrandchild_%i" % i)
  
      G.add_edge("ROOT", "Child_%i" % i)
      G.add_edge("Child_%i" % i, "Grandchild_%i" % i)
      G.add_edge("Grandchild_%i" % i, "Greatgrandchild_%i" % i)
  
  # write dot file to use with graphviz
  # run "dot -Tpng test.dot &gt;test.png"
  nx.write_dot(G,'test.dot')
  
  # same layout using matplotlib with no labels
  plt.title('draw_networkx')
  pos=nx.graphviz_layout(G, prog='dot')
  nx.draw(G, pos, with_labels=False, arrows=False)
  plt.savefig('nx_test.png')
  </code></pre>
  
  <p>I want to draw a tree as in the following figure.
  <a href="https://i.stack.imgur.com/eS29B.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eS29B.jpg" alt="enter image description here"></a></p>
  
  <p>However, I am getting an error saying <code>AttributeError: module 'networkx' has no attribute 'write_dot'</code>. My networkx version is 1.11 (using conda). I tried different <a href="https://github.com/nipy/nipype/issues/1350" rel="nofollow noreferrer">hacks</a>, but none of them worked.</p>
  
  <p>So, I am interested in knowing if there is another way of drawing tree structures using networkx to get an output similar to the one mentioned in the figure. Please let me know.</p>