Repository navigation
fix(graph): return outgoing edges in document order - #795
Merged
Merged
Conversation
petgraph prepends each new edge to a node's adjacency list, so get_outgoing_edges / get_filtered_outgoing_edges (and the grouped variant) returned a note's edges newest-first. Anything taking the first match — 'Jump to first neighbour', PrevNextView, walk_to_roots — picked the last field in the note instead of the first. Reverse to restore insertion order. traverse_note's iterative DFS emitted children in reverse link order, which the old reversed graph order happened to cancel out; push children in reverse so it keeps link order. Refs #790
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #790
petgraph prepends each new edge to a node's adjacency list, so
get_outgoing_edges/get_filtered_outgoing_edges(and the grouped variant, which wraps them) returned a note's edges newest-first. Anything that takes the first match ("Jump to first neighbour", PrevNextView,walk_to_roots) picked the last field in the note. Both queries now reverse to insertion order, which is the order the builders read fields from the note.traverse_note's iterative DFS emitted children in reverse link order, which the old reversed graph order had been cancelling out. It now pushes children reversed, so it keeps link order. Side effect: when two children both link to the same note, the earlier child now claims it.Tests:
2026-W38example (flat, filtered, grouped). They failed before the fix with exactly reversed order.traverse_notetest.typed_linkandlist_noteedges; each builder is in document order, and the builders run one after the other.