fix(query): correct frontier trimming in shortest path#9599
Open
Schwarf wants to merge 2 commits intodgraph-io:mainfrom
Open
fix(query): correct frontier trimming in shortest path#9599Schwarf wants to merge 2 commits intodgraph-io:mainfrom
Schwarf wants to merge 2 commits intodgraph-io:mainfrom
Conversation
ddde7e8 to
ae5a482
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.
Description
Fix incorrect frontier trimming in shortest path queries when
maxfrontiersizeis set.
Previously, the code used
pq.Pop()to trim the priority queue. This removesthe last element of the heap rather than the highest-cost
element, which can discard valid low-cost candidates and lead to incorrect
shortest-path results.
The fix replaces slice-based removal with
heap.Removeof the maximum-costelement.
Applied in both:
shortestPathrunKShortestPathsA regression unit test has been added to ensure the highest-cost element is
removed when trimming.
Fixes #9577