Avoid considering an edge to parent as a back edge.