One workaround is not enough. Consider the graphs 1-> 2-> 3 and 2 <-1-> 3. If you start with node 1 and crawl, you encounter the nodes in the order 1, 2, 3. If you just create a row with a pre-order, then two give the same result: 1,2,3
On the other hand, if you use post-order, the two will give a different result. 3,2,1 and 2,3,1
I bet for any order, you can find two different trees with the same result.
So, the question that you need to answer yourself to any other pair that you want to look at will be: is there a tree that will give the same order for both walks? I'm going to leave this as something to think about and come back later to find out if you have it.
source share