You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calculating distance between two nodes in SurrealDB
Calculating distance between two nodes in SurrealDB
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
Calculating distance between two nodes in SurrealDB
Calculating distance between two nodes in SurrealDB
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