title: Neo4j | Cypher - given node A, show me path to node B of C type which has more than X children of D type
body: <p>First part of query is to find nodes of type <strong>C</strong> which have more than <strong>X</strong> children of <strong>D</strong> type and I have this working:</p>
  <pre><code>MATCH (Parent:$C)
  WITH Parent, [(Child:$D)-[]-(Parent) | Child] as children
  WITH Parent, children, size(children) as ChildCount
  WHERE ChildCount &gt; $X
  
  RETURN Parent
  </code></pre>
  <p>Now I'd like to take node <strong>A</strong> and find a Path to some of nodes returned from first query.
  My query looks like this:</p>
  <pre><code>//Part A - this one is already working
  MATCH (Parent:FullAddress)
  WITH Parent, [(Child:Company)-[]-(Parent) | Child] as children
  WITH Parent, children, size(children) as ChildCount
  WHERE ChildCount &gt; 10
  WITH Parent as Target
  
  //Part B - this part doesn't work
  MATCH Path = (S:Ship)-[*2]-(Target)
  WHERE ID(S)=164758
  RETURN nodes(Path)
  LIMIT 100
  </code></pre>
  <p>The expected result is to show me path between <code>Ship</code> with <code>ID=164758</code> and one of nodes from <strong>query A</strong>. I am sure that this path exists as I checked it manually before choosing query parameters.</p>
  <p>Current result is neo4j loadig to infinity.</p>