title: Graph deletion from the root node to the leaf - based on conditions in Neo4j
body: <p>I have a graph as shown below:</p>
  <pre><code>            S1       
              / \
           ss1   ss2      
          /   \   /  \
         ss3  ss4  ss5
  </code></pre>
  <p>I want to start from the root node and then check the count of incoming and outgoing relation, if incoming = 0 and outgoing != 0 , then delete the node and relation (in the above example delete ss1 and ss2 and relation)
  if incoming  = 0 and outgoing = 0 (means its a leaf node) - delete only the node.
  Once S1 and its relations are deleted then take ss1 (in the example above) and perform the same check and keep deleting.
  The above graph is just an example : the graph will have different nodes each time.</p>