First, a couple quick notes:

- Paths are counted by relationship, not node.
`(A)->(d)->(B)`

is a path of length 2.
- The subgraph solution for the problem you described:
`(A)->(d)`

`(C)->(d)`

`(d)->(B)`

- The list of paths solution to the problem you described, which can be reduced by restricting relationship directionality:
`(A)->(d)->(B)`

`(A)->(d)<-(C)`

`(B)<-(d)<-(A)`

`(B)<-(d)<-(C)`

`(C)->(d)<-(A)`

`(C)->(d)->(B)`

### Match Intersection

The term for this is "match intersection," and there are *many* ways to go about it. Desired results, and the existing graph data, will dictate which methods are possible and perform better.

### Simple Cypher-only intersection

Any of these will solve the problem, each has different applications.

```
// can do intersections for lists of As, Bs, and Cs.
MATCH (a {name:"A"})-[]->(x)-[]->(b {name: "B"})
WITH a, b, x
MATCH (x)-[]->(c {name: "C"})
RETURN a, b, c, x
```

```
// Better for handling paths, and multiple hops
MATCH (a {name:"A"}), (b {name: "B"}), (c {name: "C"})
MATCH p1=(a)-[*2..3]-(b)
MATCH p2=(b)-[*2..3]-(c)
MATCH p3=(c)-[*2..3]-(a)
WITH a, b, c, apoc.coll.intersection(nodes(p1), nodes(p2)) as n1, nodes(p3) as n2
WITH a, b, c, apoc.coll.intersection(n1, n2) as n0
UNWIND n0 as n
MATCH p1=(a)-[]->(n)-[]->(b)
MATCH p2=(b)-[]->(n)-[]->(c)
MATCH p3=(c)-[]->(n)-[]->(a)
RETURN a, b, c, n, p1, p2, p3
```