title: neo4j how to query with variable nodes in between limiting the number of relations between subsequent nodes?
body: <p>Consider a query similar to this:</p>
  
  <pre><code>MATCH p=(b:label{ID:"M04"})-[r:Edge*2..2]-(d:label{ID:"S02"})
  RETURN p LIMIT 10
  </code></pre>
  
  <p>Let me call the intermediate node <code>c</code>. The relations from <code>b</code> to the intermediate nodes and to the final node <code>d</code> are all of the same type <code>Edge</code> and have the property <code>EdgeID</code>. From one node to another there are different relations of type <code>Edge</code> each one with a different <code>EdgeID</code> property value. To the next node there are other relations of the same type and most of them having the same value of the property <code>EdgeID</code>.</p>
  
  <p>For example the graph is similar to that:</p>
  
  <pre><code>(b)-[:Edge{EdgeID:1}]-&gt;(c)-[:Edge{EdgeID:1}]-&gt;(d)
  (b)-[:Edge{EdgeID:2}]-&gt;(c)-[:Edge{EdgeID:2}]-&gt;(d)
  (b)-[:Edge{EdgeID:3}]-&gt;(c)-[:Edge{EdgeID:3}]-&gt;(d)
  ....
  </code></pre>
  
  <p>The query returns many relations from <code>b</code> to <code>c</code> but a single relation from <code>c</code> to <code>d</code></p>
  
  <pre><code>(b)-[:Edge{EdgeID:1}]-&gt;(c)-[:Edge{EdgeID:1}]-&gt;(d)
  (b)-[:Edge{EdgeID:2}]-&gt;(c)-[:Edge{EdgeID:1}]-&gt;(d)
  (b)-[:Edge{EdgeID:3}]-&gt;(c)-[:Edge{EdgeID:1}]-&gt;(d)
  ....
  </code></pre>
  
  <p>I want to return the paths with the relations having the same <code>EdgeID</code>. So for example with <code>LIMIT 1</code> I want to return only one among the above rows, for example</p>
  
  <pre><code>(b)-[:Edge{EdgeID:123123}]-&gt;(c)-[:Edge{EdgeID:123123}]-&gt;(d)
  </code></pre>
  
  <p>(not necessarily that ID)</p>
  
  <p>With <code>LIMIT 2</code> I want to return two, for example:</p>
  
  <pre><code>(b)-[:Edge{EdgeID:123123}]-&gt;(c)-[:Edge{EdgeID:123123}]-&gt;(d)
  (b)-[:Edge{EdgeID:872346}]-&gt;(c)-[:Edge{EdgeID:872346}]-&gt;(d)
  </code></pre>
  
  <p>How can I do that?</p>