MATCH (n:Test{id:"Q1"}),(n1:Test{id:"Q2"})
RETURN
CASE
WHEN (n)-[]-(n1)
THEN "1"
ELSE "0"
END AS result
MATCH (n:Test{id:"Q1"}),(n1:Test{id:"Q2"}),p=(n)-[]-(n1)
return count(p)
不存在关系返回0,存在关系返回大于0的数
原文:https://www.cnblogs.com/Cia-L/p/11353179.html