generated from duckdb/extension-template
-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Problem
After fixing #67 with iterativelengthbounded, there's still an edge case: when using ANY SHORTEST with bounds like {1,3}, self-loops (e.g., Daniel→Daniel) can appear with path length 0.
This happens because:
iterativelengthbounded(src, dst, lower, upper)correctly finds that a path exists within bounds (e.g., a cycle of length 2)- But
shortestpath(src, dst)returns the shortest path without respecting bounds (length 0 for self)
Example
FROM GRAPH_TABLE (pg
MATCH
p = ANY SHORTEST (a:Person WHERE a.name = 'Daniel')-[k:knows]->{1,3}(b:Person)
COLUMNS (path_length(p), a.name, b.name)
)Current behavior: Returns (0, Daniel, Daniel) with path [0]
Expected behavior: Should return the shortest path within bounds or exclude the pair if no such path exists
Proposed Solution
Implement shortestpathbounded(csr_id, v_size, src, dst, lower, upper) that:
- Finds the shortest path with length between
lowerandupper - Returns NULL/empty if no path exists within bounds
- Modify
GenerateShortestPathCTEinmatch.cppto use this function when bounds are specified
Related
- Partially fixed by Fix bounded path results (issue #67) #290
- Original issue: Test if bounded path lengths get correct results #67
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels