我试图找到neo4j db中两个节点之间的所有路径
用于获取所有路径的查询返回错误,而当我将allSimplePaths更改为shortestPath以获取最短路径时,它可以正常工作:
MATCH (from), (to) ,
paths = allSimplePaths((from)-[*]->(to))
WHERE from.ID ='3007' AND to.ID in ['5575','8150', '3674']
Return paths
返回错误消息:
Invalid input '(': expected an identifier character, node labels, a property
map, a relationship pattern, ',', USING, WHERE, LOAD CSV, START, MATCH, UNWIND,
MERGE, CREATE, SET, DELETE, REMOVE, FOREACH, WITH, CALL, RETURN, UNION, ';' or
end of input (line 2, column 23 (offset: 82))
"paths = allSimplePaths((from)-[*]->(to)) "
答案 0 :(得分:1)
allSimplePaths
和allPaths
graph algorithms,但不支持Cypher。
要获得等效的allPaths
,您可以这样做:
MATCH (from), (to), paths = (from)-[*]->(to)
WHERE from.ID ='3007' AND to.ID in ['5575','8150', '3674']
Return paths
您需要使用REST API来使用allSimplePaths
。