Neo4J shortestPath通过索引中的节点

时间:2013-04-02 10:43:48

标签: python graph neo4j shortest-path cypher

我目前正在使用此Cypher查询来查找两个节点之间的最短路径:

START topic=node:cities(name='amsterdam'), top=node:categories(name='world')
MATCH p=shortestPath(topic-[*]->top)
RETURN p

但是,我需要路径中的节点具有某个属性,或者更好,属于索引类别。我怎么能这样做?

由于

2 个答案:

答案 0 :(得分:1)

这是更复杂的事情,您可能应该在https://github.com/neo4j/neo4j/tree/master/community/graph-algo/src/main/java/org/neo4j/graphalgo/impl/shortestpath

查看遍历框架和ShortestPath的实现。

答案 1 :(得分:0)

可能是那样的

START topic=node:cities(name='amsterdam'), top=node:categories(name='world') MATCH p=shortestPath(topic-[r]->top) WHERE HAS(r.PROPERTY) RETURN p

其中PROPERTY是您要为限制输出指定的任何属性

相关问题