code: def traversal(graph, node, order):
      
      visited = {}
      if (order == 'pre'):
          pre = 1
          post = 0
      elif (order == 'post'):
          pre = 0
          post = 1
      
      for each in _dfs(graph, visited, node, pre, post):
          yield each
docs: Graph traversal iterator.
  
      @type  graph: graph, digraph
      @param graph: Graph.
      
      @type  node: node
      @param node: Node.
      
      @type  order: string
      @param order: traversal ordering. Possible values are:
          2. 'pre' - Preordering (default)
          1. 'post' - Postordering
      
      @rtype:  iterator
      @return: Traversal iterator.