Looking at the image from Wikipedia page for tree traversal enter image description here what is the name for a traversal that follows the dashed line exactly with repeating visits to obtain: F, B, A, B, D, C, D, E, D, B, F, G, I, H, I, G, F;

Also is there a well known algorithm for this task?

  • $\begingroup$ The caption there reads depth first. Algorithms are given as numbered lists: what more do you expect? $\endgroup$
    – greybeard
    Jul 29 at 7:06
  • 2
    $\begingroup$ You may refer to this as the right-hand rule for visiting a maze. At leaves, you make a half-turn. If I am right, this can be implemented like a modified preorder traversal where you output the root node several times. $\endgroup$
    – user16034
    Jul 29 at 8:39
  • $\begingroup$ @greybeard I don't know I expect smart people on stack exchange to read and think before spamming. Read the results of a depth first nodes in the caption and compare with what I asked for. Are those the same to you? $\endgroup$
    – MathX
    Jul 29 at 12:47
  • $\begingroup$ @YvesDaoust thanks I tough about mazes and actually looked it up but didn't know enough to understand it can be done by half turns. Thanks for the helpful comment. I'll lo into it. $\endgroup$
    – MathX
    Jul 29 at 12:50

1 Answer 1


Maybe you're looking for Eulerian tour on trees. You can check these:

  • $\begingroup$ THANK YOU! Really.. $\endgroup$
    – MathX
    Jul 29 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.