I am not very familiar with Neo4j because I just used it for several days.
But now I want to find path between two nodes
like path : A & D
A -> B -> C -> D
A -> B -> E -> D
A -> C -> E -> D
and using "WHERE NOT" to eliminate Node B
so I will leave path A -> C -> E -> D
is there any way I can do this ?
Here is my Cypher:
MATCH (home { name:'Grove' }),(school { name:'Moulton' }),(Ann {name:'Ann'}),
p = ((home)-[*..4]->(school))
WHERE NOT ((home)-[]->(Ann))
RETURN p
It's not working for me
You can use the NONE
predicate in the WHERE
clause to filter out paths containing the B
node. See http://console.neo4j.org/?id=hppthl for an example.
The cypher statement looks like this:
MATCH p=(:Person { name:'A' })-[:KNOWS*..4]->(:Person { name:'D' }),
(without:Person { name:'B' })
WHERE NONE (x IN nodes(p) WHERE x=without)
RETURN p
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.