title: Neo4j parent-child relationship
body: <p>I have a node and I need to find all parent relationship to it till root.</p>
  
  <p>So, if I have:
  A->B->C->D(root)
  A->E->F->D(root)</p>
  
  <p>A is the node I have and I need all the ancestors of it.</p>
  
  <p>I tried the cypher query:</p>
  
  <pre><code>MATCH (n:yo {name:"foo"})-[:HELLO*1..]-&gt;(p:yo) RETURN p
  </code></pre>
  
  <p>But it shows me a list like this: B,C,D,E,F. So the connection between them is lost. Is it possible to have list like [[B->C->D],[E->F->D]]</p>
  
  <p>I saw this query on a website and it works. But it returns [[A,B],[A,B,C],[A,B,C,D]]. I don't need the subpaths. </p>
  
  <pre><code>start c = node:node_auto_index ( object_id = ‘10179’  )
  MATCH path =  c &lt;- [ : PARENT_OF* ] – p
  return  distinct
  length ( path )  AS PATH_LENGTH
  , extract ( n in nodes ( path ) : n.object_id ) as the_path
  order by length ( path )
  </code></pre>