What I want to do
- Find shortest path between two give nodes
- Result always comes empty
What I did
- Below are my schema and mutations
type Student { studentId: String! @id courses: [Course] @hasInverse(field: student) xid: String! @search(by: [hash]) } type Course { codeId: CourseTcode! eventId: Int! timestamp: DateTime! @search student: Student xid: String! @search(by: [hash]) } type CourseTcode { codeConceptId: Int! @id course: [Course] @hasInverse(field: codeId) xid: String! @search(by: [hash]) } <_:my.org/Student/10101/Course/201/Event/1> <Course.eventId> "1" . <_:my.org/Student/10101/Course/201/Event/1> <Course.timestamp> "2022-01-01T00:00:02.298240" . <_:my.org/Student/10101/Course/201/Event/1> <Course.student> <_:my.org/Student/10101> . <_:my.org/Student/10101> <Student.studentId> "10101" . <_:my.org/Student/10101> <Student.courses> <_:my.org/Student/10101/Course/201/Event/1> . <_:my.org/Student/10101/Course/201/Event/1> <Course.codeId> <_:my.org/CourseTcode/201> . <_:my.org/CourseTcode/201> <CourseTcode.codeConceptId> "201" . <_:my.org/CourseTcode/201> <CourseTcode.course> <_:my.org/Student/10101/Course/201/Event/1> .
Please list the things you have tried.
- Tried to find shortest path query
{ p_uid as var(func: eq(Student.studentId, "10101")) d_uid as var(func: eq(CourseTcode.codeConceptId, "201")) path as shortest(from: uid(d_uid), to: uid(p_uid), numpaths:2) { Course } get_path(func: uid(path)) @recurse(depth:2, loop:true) { uid } }
Dgraph metadata
dgraph version
PASTE THE RESULTS OF dgraph version
HERE.