Current version of SurrealDB doesn't have yet graph::shortest_path(node1, node2)
function. It sure will be added later to a stable release. However if the task is simplified a little bit we can calculate the distance with the available functions already.
Assume we have a graph of users that resembles a social network where users can connect (make friends). And we want to label the connection distance between two users similar to LinkedIn:
- direct connections are labeled as 1st
- connections with the shortest path of 2 are labeled as 2nd
- connections with the shortest path of 3 are labeled as 3rd
- connections with the shortest path of 4 and more are labeled as nth