when doing the shortest path, how can I return all the “names” the path has traversed through, rather than just getting the UID.
In my use case I need to find different dept of interconnections between entities.
another question would be if I want to find the with numpaths of 2 or greater, but for 3 nodes
somehow numpaths does not work in this scenario
{
A as var(func: eq(name, “Alice”))
E as var(func: eq(name, “Ethan”))
C as var(func: eq(name, “Chow”))
AEpath as shortest(from: uid(A), to: uid(E), numpaths: 2) {
friend
}
ACpath as shortest(from: uid(A), to: uid(C), numpaths: 2) {
friend
}
CEpath as shortest(from: uid(C), to: uid(E), numpaths: 2) {
friend
}
sp1path(func: uid(AEpath)) {
name
uid
}
sp2path(func: uid(ACpath)) {
name
uid
}
sp3path(func: uid(CEpath)) {
name
uid
}
}
.......................The mutation.................
{
set {
_:a <friend> _:b .
_:b <friend> _:c .
_:c <friend> _:d .
_:a <friend> _:d .
_:d <friend> _:e .
_:a <friend> _:e .
_:a <friend> _:f .
_:a <name> "Alice" .
_:a <dgraph.type> "Person" .
_:b <name> "Bob" .
_:b <dgraph.type> "Person" .
_:c <name> "Chow" .
_:c <dgraph.type> "Person" .
_:d <name> "Danny" .
_:d <dgraph.type> "Person" .
_:e <name> "Ethan" .
_:e <dgraph.type> "Person" .
_:f <name> "Francis" .
_:f <dgraph.type> "Person" .
}
}