天天看点

neo4j 查询避免多余的点,去除环路

例如:

只想查询红框里的两个节点间的关系,但是要查询6层,语句如下:

match g= (n:p)-[*..6]-(m:p) where n.sid=9229 and m.sid = 9253 return g
           

查询结果:

neo4j 查询避免多余的点,去除环路

避免其他非关键路径上的点出现:

match g= allshortestPaths((n:p)-[*..6]-(m:p)) where n.sid=9229 and m.sid = 9253  return g
           

结果:

neo4j 查询避免多余的点,去除环路