Shortest path does not respect first
... sometimes
#3663
Labels
area/querylang/algos
Related to graph algorithms, such as k-shortest path.
kind/bug
Something is broken.
priority/P2
Somehow important but would not block a release.
status/accepted
We accept to investigate/work on it.
Milestone
If you suspect this could be a bug, follow the template.
play.dgraph.io
Yes, it still fails
MacOS but also play.dgraph.io, so probably irrelevant
Run a shortest path query and use
first
oroffset
to get a specific part of the path.For instance, in order to find movies directed by Michael Bay where Megan Fox appears,
we can run this query on
play.dgraph.io
:This wils return one of the movies matching the description:
Now, if I want to get only the name of the movie, I know that this is the second element of the path, so
first:1, offset: 1
should work, but it doesn't.Depending on the combination you might get different results.
Only offset
If I set
offset: 1
I expect to see the name of the movie first (we skipped the director) followed by an anonymous node (the performance) and finally Megan Fox.Randomly, I get either the name of the movie and the performance but no Megan Fox:
But also, sometimes, I'll get just Megan Fox
Only first
If I set the request to use
first: 1
the query works correctly and only returns Michael Bay.But ... if I set it to two, randomness comes back and sometimes I'll get the right result:
And sometimes I'll get Michael Bay and Megan Fox, skipping both the movie and the performance!
Lastly, just for fun let's use first and offset together!
The query I wanted to perform to get the second element was
first: 1, offset: 1
.This will again sometimes work:
But sometimes it won't:
The text was updated successfully, but these errors were encountered: