Excluding Nodes that are unconnected
<p>I have a Graph connected as:</p>

<pre><code>           --&gt;(D)--&gt;(E)--&gt;(F)
         /
(A)--&gt;(B)
        \           
         --&gt;(C)
</code></pre>

<p>The Graph is a tree with root = A with a directed relationship from parent to child through a :HAS_CHILD</p>

<p>What I want to do is to exclude nodes for a given property for instance:</p>

<pre><code>MATCH (n:Node)
WHERE n.name &lt;&gt; "D"
return n
</code></pre>

<p>Which would give me the a subgraph:</p>

<pre><code>           (E)--&gt;(F)

(A)--&gt;(B)
        \           
         --&gt;(C)
</code></pre>

<p>Where E and F is not reachable from the root node. How do I exclude such subtrees?</p>

<p>Preferred result would be:</p>

<pre><code>(A)--&gt;(B)
        \           
         --&gt;(C)
</code></pre>