Fix recursive-rel node filter silently ignored in SHORTEST mode (#680)#693
Open
adsharma wants to merge 1 commit into
Open
Fix recursive-rel node filter silently ignored in SHORTEST mode (#680)#693adsharma wants to merge 1 commit into
adsharma wants to merge 1 commit into
Conversation
751b366 to
3108292
Compare
The node predicate on recursive relationships (e.g., `(r, n | WHERE ...)`) was being silently ignored when the recursive relationship uses SHORTEST mode (SHORTEST, ALL SHORTEST, WSHORTEST, ALL WSHORTEST). The filter was only checked during the output/path-reconstruction phase, not during the BFS traversal itself. This caused queries to return incorrect results that looked plausible. Root cause: The `pathNodeMask` (pre-computed bitmap of nodes passing the predicate) was only used in `PathsOutputWriter::checkPathNodeMask()` during path construction, but was never checked in the `EdgeCompute` functions that drive the BFS traversal. As a result, nodes failing the predicate were still visited and used as intermediate hops, allowing the traversal to reach destinations through them. Fix: Pass `pathNodeMask` from sharedState to all SHORTEST-mode EdgeCompute constructors and check the mask in each `edgeCompute()` call before adding a neighbor node to the next frontier (and before recording parent edges for path tracking). Affected algorithms: - SingleSP (destinations & paths) - AllSP (destinations & paths) - WeightedSP (destinations & paths) - AllWeightedSP (paths)
3108292 to
2596035
Compare
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.
Fixes: #680
The node predicate on recursive relationships (e.g.,
(r, n | WHERE ...)) was being silently ignored when the recursive relationship uses SHORTEST mode (SHORTEST, ALL SHORTEST, WSHORTEST, ALL WSHORTEST). The filter was only checked during the output/path-reconstruction phase, not during the BFS traversal itself. This caused queries to return incorrect results that looked plausible.Root cause: The
pathNodeMask(pre-computed bitmap of nodes passing the predicate) was only used inPathsOutputWriter::checkPathNodeMask()during path construction, but was never checked in theEdgeComputefunctions that drive the BFS traversal. As a result, nodes failing the predicate were still visited and used as intermediate hops, allowing the traversal to reach destinations through them.Fix: Pass
pathNodeMaskfrom sharedState to all SHORTEST-mode EdgeCompute constructors and check the mask in eachedgeCompute()call before adding a neighbor node to the next frontier (and before recording parent edges for path tracking).Affected algorithms: