In Match with hops query[Follows*1..3], what query can give me the degrees of separation in the response?

In Match with hops query[Follows*1..3], what query can give me the degrees of separation in the response?

I am working on a force-graph in react with a node/express api. I would like to see the actual degree of separation, 1st level, second level, etc.

Hello @asha.sundararajan :slight_smile:

I guess you are looking for the length() function.

Regards,
Cobra

As Cobra mentioned, length(path) is what you're looking for, but this requires that you add a path variable into your MATCH. Something like:

MATCH path = (user1:User {id:12345})-[Follows*1..3]-(user2)
WITH user1, user2, length(path) as pathLength
...