neo4j/community — Issue #184: Support variable length relationship predicates
Author: therubymug
Created: 2012-01-15 19:16:20+00:00
State: open

Given the following graph:

```
John-Follows-Sarah
John-Follows-Kyle

Sarah-Follows-Derek
Sarah-Follows-Kyle
Sarah-Follows-Max

Derek-Follows-Andy
Derek-Follows-Pam
Derek-Follows-Kyle
```

I want all my 3rd degree friends to NOT show any friends I may already follow on previous degrees (1st and 2nd).

```
Expected Result: Andy, Pam
```

Ideally this would work (given I also want to check a 'status' property on the Follows Relationship):

START me=node:users(name='John')
MATCH p=(me)-[rels:follows*3..3]-(degree3)
WHERE
ALL(f in rels WHERE f.status = 'connected')
AND NONE(n in NODES(p) WHERE me-[:follows*1..2]->n)
RETURN degree3.name

Unfortunately, Cypher doesn't _yet_ support variable-length relationship predicates.