# Is there a limit to the number of nodes we can specify in a path?

**URL:** <https://community.neo4j.com/t/is-there-a-limit-to-the-number-of-nodes-we-can-specify-in-a-path/34735>\
**Category:** Cypher\
**Tags:** performance\
**Created:** [March 5, 2021, 2:28pm UTC](https://community.neo4j.com/t/is-there-a-limit-to-the-number-of-nodes-we-can-specify-in-a-path/34735 "2021-03-05T14:28:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bill\_dickenson](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/bill_dickenson/32/4915_2.png) [@bill\_dickenson](https://community.neo4j.com/u/bill_dickenson)\
**Post date:** [March 5, 2021, 2:28pm UTC](https://community.neo4j.com/t/is-there-a-limit-to-the-number-of-nodes-we-can-specify-in-a-path/34735/1 "2021-03-05T14:28:33Z")

</div>

I have a query that has a few number of "hops" before it gets to resolution and I am wondering if there is a limit to this kind of thing.

![image](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/e/3/e34e39bdf5105753177e2e167ab2089ac2e4a9b5.png)

The goal is to find situations where the A is somewhere downstream from B, and C is downstream from B also but not in the same path. I found one of these with 5 hops.

> match (l {name:'A'}), (m {name:'B'{), (n {name:'C'}) where (l)\<-[_]-(m) AND ( (m)-[_]-\>(n) set b.flag = true return count(b)

or would

> match (l {name:'A'}), (m {name:'B'{), (n {name:'C'}) where (l)\<-[_]-(m)-[_]-\>(n) set b.flag = true return count(b)

work ? Are there limits to the "hops"

---

<div class="post-metadata">

**Author:** ![Cobra](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/cobra/32/35243_2.png) [@Cobra](https://community.neo4j.com/u/Cobra)\
**Post date:** [March 5, 2021, 3:50pm UTC](https://community.neo4j.com/t/is-there-a-limit-to-the-number-of-nodes-we-can-specify-in-a-path/34735/2 "2021-03-05T15:50:16Z")

</div>

Hello @bill_dickenson🙂

I think you are looking for [variable length relationships](https://neo4j.com/docs/cypher-manual/current/clauses/match/#varlength-rels).

Regards,  
Cobra
