You need to specify the intermediate nodes for now. Though I think we could make that optional given that we store the list of outgoing predicates from a uid.
@pawanrawal I think there are some real use-cases where someone would need to know whether there exists any relationship from A to D and if it exists what the shortest path is.
@pawanrawalhttps://github.com/pawanrawal I think there are some real
use-cases where we need to know whether there exists any relationship from
A to D and if it exists what the shortest path is.
@pawanrawal Just to clarify, right now there is no distinction between node property and edge and everything is predicate in dgraph right? Can we say dgraph supports property graph? Because property graph has properties and edges between nodes.
Note that limiting the depth of the search is very important, as otherwise the search space is huge.
In our case, since we know that the relationship should look like director - movie - performance - actor we’re setting it to 2 (as in two hops).
The program does the following:
fetches the UID for Steven Spielberg as a director (or whatever value -director has)
fetches the UID for Jeff Goldblum as a director (or whatever value -actor has)
fetches the list of all predicates
ignoring those starting with dgraph. as they are internal
ignoring those of type password because … there’s a bug #3657
sends a shortest path query with the UIDs and all the predicates
This works!
I hope the workaround is useful. That said, I’ll keep this issue open to consider implementing this functionality on the Dgraph server directly.