title: Tree traversal recursion
body: <p>I am new to programming. I am working on my project of tree</p>
  
  <p>my tree look like this
  <a href="https://i.stack.imgur.com/Ld0ke.png" rel="nofollow noreferrer">tree structure</a></p>
  
  <p>I have written code to traverse the complete tree. Currently my traversel will print the complete tree like this
  A,B,E,F,C,D,G,H,I,J,K</p>
  
  <pre><code>def tree_traversal(self, node):
      if(node != None):
        print node.name
        for child_nodes in node.children:
            self.tree_traversal(child_nodes)
  </code></pre>
  
  <p>However I want to get the output like this.</p>
  
  <pre><code>[[A,B,E],[A,B,F],[A,C],[A,D,G,H],[A,D,G,I],[A,D,G,J],[A,D,G,K]]
  </code></pre>