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