I’m a bit rusty on this stuff, but recall experimenting and the automagical way SWI-Prolog traverses graphs isn’t the same as in the historical texts, and is completely different with tabling.
The safest way to ensure depth first or breadth first is to manage the listied tree yourself. I recall doing a simple example which I put up here Tree Breadth-First in Prolog - #18 by joeblog