I am currently using Neo4j Community version 3.5.17. I have :Person nodes out of which a few are :Fraud nodes. For a certain :Person node, I would like to find out how many hops away is the closest :Fraud node.
I have used the following queries up till now but I think there might be a better implementation -
MATCH p=shortestPath( (a:Person {fid:''})-[*..6]-(b:Fraud)) RETURN p limit 1;
MATCH path=(a:Person {fid:''})-[*1..6]-(p:Fraud) RETURN a.fid, min(length(path)) AS distance;
Please let me know if there might be some BFS like implementation because the number of nodes grow very fast as the number of hops increase.