title: How to get count of intermediate vertices?
body: <p>Let's say there is a tree-like structure.</p>
  
  <p>Top level: Warehouse</p>
  
  <p>Next level: Storage space</p>
  
  <p>Last level: Stored item</p>
  
  <p>I want to get count of Storage spaces and Storage items per each warehouse.</p>
  
  <p>I've already tried to get the number of Stored items: it's done pretty easily  using groupCount.</p>
  
  <pre><code>g.V().
        hasLabel('Warehouse').
        as('w').
        out('HAS_SPACE').
        hasLabel('Space').
        as('s').
        out('HAS_ITEM').
        hasLabel('Item').
        groupCount().by(select('w')).
        unfold().
        order().by(values, desc).
        limit(100).
        project('WarehouseName', 'ItemsCount').
            by(select(keys).values('Name')).
            by(select(values))
  </code></pre>
  
  <p>However I want to get count of 's' as well and I can't think of any fast way to achieve it. I've thought about counting traversals something like:</p>
  
  <pre><code>g.V().
        hasLabel('Warehouse').
        project('WarehouseName', 'SpaceCount', 'ItemCount').
            by('Name').
            by(out('HAS_SPACE').count()).
            by(out('HAS_SPACE').out('HAS_ITEMS').count())
  
  </code></pre>
  
  <p>but it works extremely slow on large number of vertices (there are about 26M).</p>
  
  <p>Is there any other way to get that count?</p>