#NEWLINE# def __str__( self ) : #NEWLINE# #INDENT# outputStr = ( super ( DictTree , self ) . __str__ ( ) + '\n' ) #NEWLINE# root = self . getRootId ( ) #NEWLINE# stack = [ ( root , 0 ) ] #NEWLINE# while ( len ( stack ) != 0 ) : #NEWLINE# #INDENT# ( vertexId , depth ) = stack . pop ( ) #NEWLINE# outputStr += ( ( ( ( ( '\t' * depth ) + str ( vertexId ) ) + ': ' ) + str ( self . getVertex ( vertexId ) ) ) + '\n' ) #NEWLINE# neighbours = self . neighbours ( vertexId ) #NEWLINE# for neighbour in neighbours : #NEWLINE# #INDENT# stack . append ( ( neighbour , ( depth + 1 ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return outputStr