Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

67 shortest path bounded #98

Closed
wants to merge 44 commits into from
Closed

Conversation

SiberiaWolfP
Copy link
Collaborator

Fixes #67 and #94.

Now bounded length query like:

-FROM GRAPH_TABLE (pg4
    MATCH
    p = ANY SHORTEST (a:Point4)-[k:know4]->{2,3}(b:Point4)
    COLUMNS (a.id, b.id, vertices(p))
    ) tmp;

will look for the shortest path between the source and the destination with a length between 2 and 3.
To disambiguate, the effect of this syntax is consistent with choosing the shortest path between the upper and lower bounds after finding all possible paths between two nodes.

Copy link
Contributor

@Dtenwolde Dtenwolde left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

I think the introduced changes will cause degrading performance because of the added complexity. Before we could guarantee that once a node was seen, it would never be seen again, but when the lower bound is greater than 1 it might be on a cycle and this guarantee can no longer be given.

Since a user might not always have a lower bound that is greater than 1 I suggest copying these iterativelength and shortestpath implementations to new files, and create UDFs with a slightly altered name (iterativelength_lowerbound and shortestpath_lowerbound would be good I think).
Then in match.cpp we can decide which UDF to call depending on the lower bound.

The goal of your project is to change how shortest path is done anyway, so this might change even more soon :)

duckpgq/src/duckpgq/functions/scalar/shortest_path.cpp Outdated Show resolved Hide resolved
duckpgq/src/duckpgq/functions/scalar/shortest_path.cpp Outdated Show resolved Hide resolved
duckpgq/src/duckpgq/functions/scalar/iterativelength.cpp Outdated Show resolved Hide resolved
duckpgq/src/duckpgq/functions/scalar/iterativelength.cpp Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Sep 3, 2024

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Sep 3, 2024
@Dtenwolde
Copy link
Contributor

Update; closing this issue, but will use the techniques used here (two-phase path-finding) to implement correct lower-bound constrained path-finding in another PR which is more up-to-date

@Dtenwolde Dtenwolde closed this Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants