title: Very strange behavior with neo4j OPTIONAL MATCH in a linked list
body: <p>I have a linked list structure of kind:</p>
  
  <pre><code>(root:`Desk`)-[:linked_list*0..]-&gt;(article:`Article`)-[:linked_list]-&gt;...-[:linked_list]-&gt;(root:`Desk`)
  </code></pre>
  
  <p>To query all elements of the list I use this query:</p>
  
  <pre><code>MATCH (r)-[:linked_list]-&gt;(e) 
  WHERE ID(r) = {r_id} 
  AND r &lt;&gt; e 
  RETURN e
  </code></pre>
  
  <p>And it works very well.</p>
  
  <p>But when I try to optional match some relations linked to an <code>Article</code>, the query really takes a lot, and I obtain a lot of strange data.</p>
  
  <pre><code>MATCH (r)-[:linked_list]-&gt;(e) 
  OPTIONAL MATCH (e)-[:author]-&gt;(u:`User`) 
  WHERE ID(r) = {r_id} 
  AND r &lt;&gt; e 
  RETURN e, [collect(a)] as authors
  </code></pre>
  
  <p>I tried to visualize the result on <a href="http://localhost:7474" rel="nofollow noreferrer">http://localhost:7474</a> , and here's a result:</p>
  
  <p><a href="https://i.stack.imgur.com/Nz08y.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nz08y.jpg" alt="query results"></a></p>
  
  <p>It seems to fill <code>r</code> and <code>e</code> with all values of the database.</p>
  
  <p>Any idea why this happens?</p>