A as var(func: eq(name, “test1”)) # Obtain uid of your starting node B as var(func: eq(name, “test5”)) # Obtain uid of your ending node path as shortest(from: uid(A), to: uid(B)) { next # Specifying the predicate(s) potentially traversed in your path } path(func: uid(path)) { name }