Show optimization strategies firing in the Unnecessary Steps recipe - #3613
Merged
Merged
Conversation
The Unnecessary Steps anti-patterns recipe stated that TinkerPop rewrites these traversals automatically but offered no way to confirm it, never named the strategies involved, and gave no pointer to further reading. Add a runnable explain() example on the original queries so the rewrites are visible, name the IncidentToAdjacentStrategy and AdjacentToIncidentStrategy strategies that perform them, and cross-reference the explain() and profile() steps and the traversal strategies section of the reference documentation. Assisted-by: Kiro:claude-opus-4.8
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3613 +/- ##
============================================
+ Coverage 76.35% 76.46% +0.10%
- Complexity 13424 14294 +870
============================================
Files 1012 1036 +24
Lines 60341 64620 +4279
Branches 7075 7664 +589
============================================
+ Hits 46076 49409 +3333
- Misses 11548 12120 +572
- Partials 2717 3091 +374 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
The "Unnecessary Steps" section of the anti-patterns recipe correctly teaches the manual rewrites (
outE().inV()toout(), and folding a counted adjacency onto its incident edges), and states that TinkerPop performs these rewrites automatically through optimization strategies. However the section gave a reader no way to confirm that claim, never named the strategies involved, and offered no pointer to further reading.This change addresses that gap:
explain()example on the two original (unoptimized) queries so the optimizations are visible in the compiled traversal rather than taken on faith. The block is executed at doc-build time against the modern graph, so the transcript is real output.IncidentToAdjacentStrategy(which foldsoutE("created").inV()into a singleout("created")step) andAdjacentToIncidentStrategy(which rewrites the counted adjacency back onto the incident edges), and explains how to read the strategy/category columns and theFinal Traversalline.explain()andprofile()steps and the traversal strategies section of the reference documentation.The change is scoped to
docs/src/recipes/anti-patterns.asciidoc(+26 lines). The rendered recipes book was previewed locally to confirm the liveexplain()transcript renders and the new prose displays cleanly.