I’m working on a project where I need to find the route between two nodes. So I’m wondering is dgraph a good solution? And if it is how would you do that?
Lets say I have the data below. I’d like to only show the “route” leading to test5.
Hi there, Victor. It sounds like a K Shortest Path Query might suit your needs.
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
}
This is an adaptation of the examples provided in the documentation. You might also look at the docs to see if any of the optional arguments (numpaths and depth) or weighting of edge traversal by facet values are useful to you. Hope this helps.