title: Cypher: How to match relationship-node-relationship within a path
body: <p>I am new to Cypher and Neo4j (and Stack Overflow for that matter), so hopefully this question has an easy answer.  I have spent hours reading the documentation and Googling, but found nothing exactly on point to answer this question.</p>
  
  <p>Apparently I need more reputation to post images, so I will do my best with text.  </p>
  
  <p>I can find the path from one node to another like such:</p>
  
  <pre><code>    MATCH path = (a {name:"a"})-[*]-(x {name:"x"})
      RETURN extract(r IN nodes(path) | r);
  </code></pre>
  
  <p>Which could return something like the following two paths:</p>
  
  <pre><code>    (a)-[:RED]-&gt;(b)&lt;-[:BLUE]-(c)-[:RED]-&gt;(f)&lt;-[:RED]-(g)-[:BLUE]-&gt;(h)&lt;-[:RED]-(x)
  
      (z)-[:RED]-&gt;(h)&lt;-[:RED]-(x)
  </code></pre>
  
  <p>So far so good.  There are, of course, lots of other relationships and nodes in the database that connect to these nodes, but this is the right path.</p>
  
  <p>I need to find the one node along the path that has two RED relationships coming into it like so:</p>
  
  <pre><code>    -[:RED]-&gt;(findme)&lt;-[:RED]-
  </code></pre>
  
  <p>In the two path examples above, findme = (f) and (h).</p>
  
  <p>Note: There will be lots of matches in the database, but I only want the one in the path (should only be one).  Also, there could be many nodes and different relationships in the path, or as few as only 3 nodes each connected by the RED relationship.</p>
  
  <p>I tried matching using:</p>
  
  <pre><code>    MATCH (a)-[*]-(b)-[:RED]-&gt;(findme)&lt;-[:RED]-(c)-[*]-(x) RETURN findme;
  </code></pre>
  
  <p>which works as long as there are at least 5 nodes, but won't work for 3 nodes.</p>
  
  <p>How can I find this pattern match within a path?</p>