Skip to content

Conversation

@andrejtonev
Copy link
Contributor

@andrejtonev andrejtonev commented Aug 7, 2025

New type of variable expand (KShortest) (n1)-[*KShortest]->(n2)
The current implementation supports only search between two predefined nodes (not really an expand operator).
The user needs to capture these nodes via a WITH n1, n2 clause.
The reason is that we first find the shortest path and then slowly expand the search to other shortest paths, returning the shortest paths first.
Implementation supports path length filtering, but does not support user defined node/edge filtering.
Transaction aborts, fine-grain access control and hops limit are also supported.
Added feature: limit number of results via a variable inside the edge expression -[*KShortest lb..ub | n]->

@andrejtonev andrejtonev added this to the mg-v3.5.0 milestone Aug 7, 2025
@andrejtonev andrejtonev requested a review from Josipmrden August 7, 2025 09:59
@andrejtonev andrejtonev self-assigned this Aug 7, 2025
@andrejtonev andrejtonev added feature feature Docs needed Docs needed CI -build=coverage -test=core Run coverage build and core tests on push CI -build=debug -test=integration Run debug build and integration tests on push CI -build=release -test=e2e Run release build and e2e tests on push CI -build=release -test=stress Run release build and stress tests on push labels Aug 7, 2025
Exists early if hops limit reached
Fix: hops counting (in summary)
Early break if upport limit reached while expanding
Fix: Returns empty set if vertices are null or same start and end
@Josipmrden Josipmrden changed the title Feature: Find all paths and return ordered shortest to longest KShortest paths Aug 9, 2025
Copy link
Contributor

@Josipmrden Josipmrden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something seems off with the number of hops traversed (maybe it's exponential execution, at least at first glance). + it would be good to add the number of paths inside the relationship kshortest brackets, something like [ *kShortest 50]

@andrejtonev andrejtonev removed CI -build=coverage -test=core Run coverage build and core tests on push CI -build=debug -test=integration Run debug build and integration tests on push CI -build=release -test=e2e Run release build and e2e tests on push labels Aug 11, 2025
@andrejtonev andrejtonev removed the CI -build=release -test=stress Run release build and stress tests on push label Aug 11, 2025
@andrejtonev andrejtonev enabled auto-merge August 11, 2025 19:07
@sonarqubecloud
Copy link

@Josipmrden Josipmrden self-requested a review August 11, 2025 19:36
@andrejtonev andrejtonev added this pull request to the merge queue Aug 11, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 11, 2025
@imilinovic imilinovic added this pull request to the merge queue Aug 11, 2025
Merged via the queue into master with commit 1c85130 Aug 11, 2025
17 checks passed
@imilinovic imilinovic deleted the all_paths_asc branch August 11, 2025 23:02
@gitbuda gitbuda mentioned this pull request Aug 17, 2025
81 tasks
@andrejtonev
Copy link
Contributor Author

andrejtonev commented Aug 20, 2025

Tracking

  • [Link to Epic/Issue]

Standard development

CI Testing Labels

  • Select the appropriate CI test labels (CI -build=build-name -test=test-suite)

Documentation checklist

  • Add the documentation label
  • Add the bug / feature label
  • Add the milestone for which this feature is intended
    • If not known, set for a later milestone
  • Write a release note, including added/changed clauses
    • New feature: Added KShortest expand operator ((n1)-[*KShortest]->(n2)), supporting shortest-path search between two nodes with path length filtering, hop limits, and result limits. Users can now query multiple shortest paths, returned in order of length, and restrict them by length, hops, or number of results. Use WITH n1, n2 to define the endpoints, and apply filters or result limits directly in the KShortest expression as needed. 3170
  • K shortest paths documentation#1369
    • Is back linked to this development PR

as51340 pushed a commit that referenced this pull request Oct 24, 2025
New type of variable expand (KShortest) `(n1)-[*KShortest]->(n2)`
The current implementation supports only search between two predefined
nodes (not really an expand operator).
The user needs to capture these nodes via a WITH n1, n2 clause.
The reason is that we first find the shortest path and then slowly
expand the search to other shortest paths, returning the shortest paths
first.
Implementation supports path length filtering, but does not support user
defined node/edge filtering.
Transaction aborts, fine-grain access control and hops limit are also
supported.
Added feature: limit number of results via a variable inside the edge
expression `-[*KShortest lb..ub | n]->`
@gitbuda gitbuda mentioned this pull request Dec 16, 2025
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs needed Docs needed feature feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants