You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
STRATEGY BREADTH_FIRST performs a depth-first traversal #5158
TRAVERSE ... STRATEGY BREADTH_FIRST walks the graph depth-first instead of breadth-first.
BreadthFirstTraverseStep consumes entry points from the front of the entryPoints deque (removeFirst) but pushes newly discovered children onto the front as well (addFirst). Front-in/front-out is a LIFO stack, i.e. the exact behavior of DepthFirstTraverseStep - so BREADTH_FIRST produces a depth-first order. Its own prettyPrint even reports DEPTH-FIRST TRAVERSE. The step has behaved this way since its first commit (OrientDB's equivalent is a correct FIFO).
On a balanced binary tree (1 -> {2,3}; 2 -> {4,5}; 3 -> {6,7}) the emitted $depth sequence is [0,1,2,2,1,2,2] (depth-first) instead of the correct [0,1,1,2,2,2,2] (level order). The existing breadthFirst() test could not catch this because it ran on a linear chain, on which BFS and DFS emit identically.
Fix: push discovered nodes to the end of the deque (addLast) so it is a FIFO queue and the traversal is genuinely breadth-first; also correct the prettyPrint label.
Activity
lvca commentedon Jul 9, 2026
Fixed by #5134, merged in f0a9a56.