In what way is DFS like the Euler tour of a tree?
An Euler tour walks around a tree, down each edge and later back up the same edge, meeting each node before its children (preorder) and again after them (postorder). DFS moves the same way along its discovery edges: it walks down an edge when it discovers a vertex and back up when that recursive call returns, so every discovery edge is travelled twice.
* Down on the left, back up on the right: eight moves for four edges. *
The Euler tour of a binary tree imagines walking around the outside of the tree, keeping it on the left, and meets each node three times: from the left, before its left subtree (where preorder acts), from below, between its two subtrees (inorder), and from the right, after both (postorder). Preorder, inorder and postorder are each the Euler tour with only one of the three visits switched on: all three make the same walk and differ only in when a node is handled. Level order is a different walk altogether, the tree case of breadth-first search.
DFS on a graph makes the same walk around its DFS tree. Work done at the start of a call happens in preorder (A, B, C, D, E in the example), work done after the loop over the edges happens in postorder (D, E, C, B, A). The match is only approximate: a graph vertex has no left and right child, the tree is built during the walk rather than given in advance, and the walk also glances along back edges, which belong to no tree. On a graph that is itself a tree, DFS from the root is exactly the preorder and postorder traversal.
Go deeper:
Tree traversal: depth-first search โ the three positions on one walk around a tree at which pre-, in- and post-order handle a node.