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

Redundant work of finding shortest path when one vid does not exist #4634

Closed
casualwind opened this issue Sep 9, 2022 · 3 comments · Fixed by #4672
Closed

Redundant work of finding shortest path when one vid does not exist #4634

casualwind opened this issue Sep 9, 2022 · 3 comments · Fixed by #4672
Assignees
Labels
severity/minor Severity of bug type/bug Type: something is unexpected
Milestone

Comments

@casualwind
Copy link
Contributor

casualwind commented Sep 9, 2022

Dataset: Nebula-Bench LDBC-SNB benchmark

nGQL: FIND SHORTEST PATH FROM 933 TO 153931628329323366 OVER * YIELD path as p

Problem: Query the shortest path of two vids and one vid does not exist (for example, in the nGQL shown above, 933 exists and 153931628329323366 does not exist).
In the first loop, vid 933 returns a non-empty set in Getneighbors executor, and vid 153931628329323366 returns an empty set in Getneighbors executor, so it should be able to determine that the shortestpath does not exist. Instead, the loop executor does not stop because of this, it will still loop three times to calculate the second-order and third-order neighbor nodes of vid 933 based on Execution plan, which increases a lot of computational overhead.

Observing the execution plan with profile can find:
image

For vid 153931628329323366:
image

For vid 933:
image

I'm working on it and trying to fix it.

Thanks,
Rulin Huang

@casualwind casualwind added the type/bug Type: something is unexpected label Sep 9, 2022
@Sophie-Xie Sophie-Xie added this to the v3.3.0 milestone Sep 9, 2022
@nevermore3
Copy link
Contributor

you can modify the loop termination condition, in the src/graph/planner/PathPlanner.cpp file

@casualwind
Copy link
Contributor Author

casualwind commented Sep 14, 2022

@nevermore3
Thank you for your suggestion.
My general idea is:
Due to each loop, all the other neighbor vids are found for the current vid. Then, it can be judged that if no new neighbor vids are added after the latest loop, it means that the connected graph constructed by leftvid or rightvid has formed a complete divided subgraph, and there is no shortest path between leftvid and rightvid.
The judgment condition that needs to be added is to judge whether there are new neighbor vids joining the left and right vids after a loop, and if not, end the loop.
This method is effective not only for the non-existing vid, but also for the divided subgraph when judging whether the loop should end.
Does it mean to modify singlePairPlan and singlePairLoopCondition in src\graph\planner\ngql\PathPlanner.cpp? Get the conditions that need to be judged from the ObjctPool?

@casualwind
Copy link
Contributor Author

@nevermore3 I have pulled it on #4672.
If you have time you can check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor Severity of bug type/bug Type: something is unexpected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants