Neo4j Finding path but without a certain node

cypher, neo4j, nodes, path

Solution

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

Problem

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

Original source